arka roy
arka roy

Reputation: 1

CRM 2011 -How do I retrieve selected value of a global option set used in an entity?

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

Answers (2)

hkhan
hkhan

Reputation: 863

Xrm.Page.getAttribute("your_column_name").getValue();

Upvotes: 0

Joseph Duty
Joseph Duty

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

Related Questions