I've created Multi-select option-set field (category) in Dynamics CRM on-premise for Contact and Projects. Now using button click I'm trying to set the value of multi-select field on Project. But each time I am coming across with Error:
Error converting value 920650008 to type System.Collections.Generic.List 1[System.Int32]
.
Since the multi-select optionset field is global so there is no chance of specified values available or not.
Here is what I am trying previously:
var name = formContext.getAttribute(new.account_metada.CompanyName).getValue();
var entityFormOptions["entityName"] = "new_projects";
entityFormOptions["openInNewWindow"] = true;
var formParameters["new_company"] = id;
formParameters["new_companyname"] = name;
formParameters["new_category"] = formContext.getAttribute("new_category").getValue()
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
console.log(success);
},
function (error) {
console.log(error);
});
Please let me know how to can I set value of multi-select optionset using Xrm.Navigation.openForm
var multiSelectOptionSet = formContext.getAttribute("new_category").getValue();
Debug and check whethermultiSelectOptionSet
returns Array. If it does thenformParameters["new_category"] = multiSelectOptionSet
This shall help. Also for testing you can pass hardcode array values of Multiselect to check if all works properly. – AnkUser