Friday, June 10, 2011

Loop through OptionSet Using Javascript in Microsoft CRM 2011

In this short post I will show you how to loop through the optionSet option in Microsoft Crm 2011 in JavaScript. some time you need to check specific text or value in the optionSet and then enable/ disabled or show hide some of the control on the form.


List 1

In the code above listed in List 1 I have used the OptionSetControl.getOptions() function to get all the optionSet options and then use the lenght property which return the number of options in the optionSet. In for loop I have used the alert to show the option text and value.

All and any comments / bugs / suggestions are welcomed !

4 comments:

Bernybon said...

Would you know how to remove an option from the list getOptions(), because I want the picklist to show only what needed.

Anonymous said...

Shouldn´t the for loop have the inequality sign:
for(var intCounter=0; intCounter<OptionSetControl.getOptions().length; intCounter++)

???

Regards,

Anonymous said...

When i get all the options in the pick list using "OptionSetControl.getOptions() " Why can i get the length of this by using OptionSetControl.getOptions().length;??

Unknown said...

Every Young ladies , Womens & Girl are Found of Shopping .For an Auspicious Occassions Like Festival , Wedding Ceremonies Engagements Ceremony So, Here We Have Some For You In Your Budget. For More....
Plz visit :- http://www.indian.supply/