Reputation: 1
I'm using a global option set in CRM 2011. After related this with an entity I can't retrieve the selected value of that option set. Attribute returns null everytime. Can anyone please help?
Upvotes: 0
Views: 161
Reputation: 795
Getting values of global optionsets is not different from entity-specific option sets. Here is a sample snippet from a plugin of getting the value of an optionset (the status of a service activity) and conditionally "doing stuff" if the option set value is set to a specific value:
ServiceAppointment relatedAppt = (ServiceAppointment)OrganizationService.Retrieve(
ServiceAppointment.EntityLogicalName.ToString(), email.new_RelatedServiceActivity.Id, new ColumnSet(true));
if (relatedAppt.StatusCode.Value == 4)
//Do stuff
here is a sample of getting the current value from an optionset in javascript from a field called new_type:
Xrm.Page.getAttribute("new_type").getValue();
Upvotes: 1