Most Used Plugin Syntax in Dynamics 365 CRM
We always get requirement which can not be possible using OOB features of CRM and hence we move to the plugin to achieve such requirements. Whenever we need to retrieve field value from plugin, we always check whether field contains value or not by using if else block or ternary operator which makes code lengthy and not readable. In this blog, we will see how to efficiently retrieve field values of different data types. //Single Line Of Text {Defualt Value = null} string businessWebsite = account.GetAttributeValue<string>("new_website"); Console.WriteLine($"Single Line Of text : {businessWebsite}"); //get optionset text string cohort = account.Attributes.Contains("new_type") ? account.FormattedValues["new_type"] : ""; //Optionset {Defualt Value = null} int? customerCohort = account.GetAttributeValue<optionsetvalue>("new_type")?.Value; //currency {Defualt Value = null} int? mostRecentACR = (int?)account.GetAttr...