RE: Qucick Create Close Opportunity custom field
Hi Elpibato,
Because these two fields actually belong to two different entities.
In addition to workflow/flow/plugin, you could also run custom javascript function at OnSave event of Quick Create Close Opportunity Form to update the corresponding field of parent opportunity.
Just replace the first "new_testmultipleoptionset" with name of your own multiple option set of Close Opportunity entity, and replace the second with Opportunity's'.
function updateParent(executionContext) {
var formContext = executionContext.getFormContext();
var multiOpt = formContext.getAttribute("new_testmultipleoptionset").getValue();
var parentOpportunity = getParameterByName("id");
var data =
{
"new_testmultipleoptionset": multiOpt.toString()
}
Xrm.WebApi.updateRecord("opportunity", parentOpportunity, data).then(
function success(result) {
console.log("Updated");
},
function (error) {
console.log(error.message);
}
);
}
function getParameterByName(name, url) {
if (!url) url = parent.window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' name '(=([^]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\ /g, ' '));
}
Run updateParent function at OnSave event:


Note: To update parent opportunity properly, make sure value of multiple optionset of Close Opportunity can map to value of multiple optionset of Opportunity.
e.g:
Multiple optionset of Close Opportunity
Option 1 -> 1000
Option 2 -> 1001
Option 3 -> 1002
Multiple optionset of Opportunity(same)
Option 1 -> 1000
Option 2 -> 1001
Option 3 -> 1002
Regards,
Clofly