Letoir
Letoir

Reputation: 405

OptionSet is not selectable

I am creating a Dynamic OptionSet where I get all Aditional Addresses from Account to then select which address to copy from on Contact.

My code looks like the following :

        var pickListField = xrmPage.getControl("nav_selectaddress");

        var retrievestring = serverUrl + "/xrmservices/2011/OrganizationData.svc/CustomerAddressSet?$select=Name&$filter=ParentId/Id eq guid'" + customerId + "'";

        var recordinfo = Retrieve(retrievestring);  
        if (recordinfo != null) {

            for(var i = 0; i < recordinfo.results.length; i++){
                if (recordinfo.results[i].Name != null){

                    var option = {};
                    option.value = option.innerText = i;
                    option.text = option.innerText = recordinfo.results[i].Name;

                    pickListField.addOption(option); 

                }

What happens is that all the address will show up in the Optionset, but i cant select them. Whenever I select one of them the OptionSet field get blank.

What could the problem be?

Upvotes: 0

Views: 126

Answers (1)

Guido Preite
Guido Preite

Reputation: 15128

Adding non-existing values to an optionset it is not supported.

The alternative is to create an HTML web resource, cleaner than using a crm optionset field..

Upvotes: 1

Related Questions