GetPickListProperty.name Returns Null in PreCreate

In CRM 4.0 using the Target.GetPickListProperty("fieldname").name property would return the string value of the pick list item display name even in a PreCreate plugin step.  Apparently though in 2011 the name property just returns null until after the initial create has been done.  Instead of using name make sure to use the Value property which is always available.

mypicklist Example:
Value  Name
1         Approve
2         Cancel

PreCreate step:
Target.GetPickListProperty("mypicklist").name  // this would return null
Target.GetPickListProperty("mypicklist").Value // this would return either 1 or 2

PostCreate step:

Target.GetPickListProperty("mypicklist").name  // this would return either "Approve" or "Cancel"
Target.GetPickListProperty("mypicklist").Value // this would return either 1 or 2


Comments

Popular posts from this blog

Add User As Local Administrator On Domain Controller

Calling Dataverse Web API in PowerShell using Client Credentials

Windows Server 2008R2 VMs Shut Down After 1 to 2 Hours