I have created two quick create forms for my 'PhoneCall' activity table,
I have added a custom ribbon button on the main form of my Case(incident) entity and want to open a particular Quick create form based on a Security role and if not then I need to open a different Quick Create form in all the other cases.
I had added a similar button to the consumer entity and was able to open the 2 Quick Create forms dynamically based on security roles till yesterday , but now only the default quick create form opens even after passing the JS code condition.
kindly help me to open different Quick Create forms based on security roles as it is necessary for my business requirement.
below is the code snippet that I had been currently and which was working as of yesterday but no longer works now.
const userSettings = Xrm.Utility.getGlobalContext().userSettings;
let roles = userSettings.roles._collection;
// Security Role : ABC
let flag = false;
for (let element in roles) {
if (roles[element].name == "ABC") {
flag = true;
break;
};
}
//var currentFormID = Xrm.Page.ui.zformSelector.getCurrentItem().getId();
let callMaskingQuickCreateFormId = "GuidA";
let defaultQuickCreateFormId = "GuidB";
if (flag) entityFormOptions["formId"] = callMaskingQuickCreateFormId;
else entityFormOptions["formId"] = defaultQuickCreateFormId;
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
console.log("new form to create phone call", success);
},
function (error) {
console.log(error);
}
);

Report
All responses (
Answers (