Sunday, June 5, 2011

How to retrieve the optionset text and value in CRM 2011

In this post I will show you how to get the selected text and value from the optionSet using javascript in Microsoft Dynamics Crm 2011

List 1

In the code listed in the List 1 you can see that I have used two option to get the selected value of the option set. By using getSelectedOption function which has the text and the value properties and second option is getText() and getValue() function which also return same values. The output of the getSelectedOption() function can be seen in the Image 1. I have display the values using watch here you can see that It has only two properties one is text and second one is value which is number type.
Image 1

The output of the getText() and getValue() can be see in the Image 2. Here you can see same values are displayed which are shown in the Image 1  Text is string type and value is Number type which you can see in the Image 2.

Image 2

All and any comments / bugs / suggestions are welcomed !

1 comment:

Anonymous said...

Hey Asim,

thanks for your post.

Do you also have an idea how I can check the value of the description field of an optionset?

does: alert(selectedOptionSet.getSelectedOption().description);


Greetings Jobengaru