RE: Mapping between multiselect fields
Hi partner,
Are the two forms in same entity or different entity?
If the forms are from different entities and they are related with each other, you could use JS on form B to get the value of multiselect field on form A first and decide what to do on your form B.
Let's say form A in entity A and form B in entity B, then entity A should has an N:1 relationship with entity B which means entity A should be parent entity.
Here's the sample code.
//get field value based on lookup field.
function getValueByCustomer(executionContext){
formContext=executionContext.getFormContext();
var customer=formContext.getAttribute("customerid").getValue();
if(customer != null){
var customerId = customer[0].id.replace("{", "").replace("}", "");
//get field value from related account
Xrm.WebApi.retrieveRecord("account", customerId, "?$select=fieldname").then(
function success(result) {
//set value from account form to order form
formContext.getAttribute('new_fieldName').setValue(result.fieldname);
},
function (error) {
console.log(error.message);
// handle error conditions
}
);
}
}
Best Regards,
Leo