Search This Blog

Friday, November 28, 2014

How to read OptionSet Attribute in MS CRM 2011/13

Following is the code on how to read OptionSet Value into Array in JavaScript

function GetMultiSelectOptions(id) {
   
    var optionsArray = new Array();
    var options = Xrm.Page.getAttribute("ap_postprofiletasks").getOptions();  // Read OptionSet Field
    if (options && options.length)
    {
        for (var i = 0; i < options.length; i++) {
            var option = options[i];
            if (option.value && option.text) {
                if (option.value == 778210006) {
                    alert(option.text);
                    optionsArray.push({ text: option.text, value: option.value });
                }
            }
        }
       
    }
    return optionsArray;
}

No comments:

Post a Comment