Hi All,
I have used the below code in online crm 9.1 to load the specific from based on lookup field value & called the method onload of case but its not working in online but this code worked in onprem 9.0 version.What could be the issue ?
//Show form based on Interaction Type, keep this method in all case forms
function showForm(executionContext) {
try {
var formContext = executionContext.getFormContext();
var interactionType = GetLookupName(formContext, "mdc_interactiontype");
var lblForm;
var relType = interactionType
switch (relType) {
case "Gift & Entertainment":
lblForm = "Case Overview - G&E";
break;
case "Conflict of Interest":
lblForm = "Conflict of Interest";
break;
case "Investigation":
lblForm = "Case Overview - Investigation";
break;
case "Enquiry":
lblForm = "Case Overview - Enquiry";
break;
case "Personal Trade Management":
lblForm = "Case Overview - Personal Trade Management";
break;
case "Restricted Security Management":
lblForm = "Restricted Securities";
break;
default:
lblForm = "Case Overview - G&E";
}
//check if the current form is form need to be displayed based on the value
var formLabel = formContext.ui.formSelector.getCurrentItem().getLabel();
if (formLabel != lblForm) {
var items = formContext.ui.formSelector.items.get();
for (var i in items) {
var item = items[i];
var itemId = item.getId();
var itemLabel = item.getLabel()
if (itemLabel == lblForm) {
//navigate to the form
item.navigate();
}
}
}
} catch (error) {
var errorOptions = {
details: "Error in CaseOverviewEnquiry js, Method Name:showForm().Download Error log file",
errorCode: 2,
message: error.message
};
Xrm.Navigation.openErrorDialog(errorOptions);
}
}
Any idea anyone it will be appreciated !!
Thanks,
Jharana