Hi,
I'm not sure if I'm in the right place. But I am currently having an issue where I'm getting a general error message when trying to switch between forms through changing an object.
The error message I am getting is:
Field:window
Event:onload
Error:undefined
Here's the code I am using, - I am no where near being remotely close to advanced at CRM/Javascript, but this is what I found online doing a bit of tweaks for my own CRM. I can see it works with CRM 2013, I was just wondering how I could possibly debug or change to make it work with CRM 2015.
function jpe_showForm() {
//if the form is update form
//"==2" is update
if (Xrm.Page.ui.getFormType()==2) {
// variable to store the name of the form
var lblForm;
// get the value picklist field
var relType = Xrm.Page.getAttribute("new_jobtype").getValue();
// switch statement to assign the form to the picklist value
//change the switch statement based on the forms numbers and picklist values
function GetFormName(recordType)
switch (recordType) {
case 1:
lblForm = "PGM";
break;
case 2:
lblForm = "Billable";
break;
default:
lblForm = "Case";
}
// Current form's label
var formLabel = Xrm.Page.ui.formSelector.getCurrentItem().getLabel();
//check if the current form is form need to be displayed based on the value
if (Xrm.Page.ui.formSelector.getCurrentItem().getLabel() != lblForm) {
var items = Xrm.Page.ui.formSelector.items.get();
for (var i in items) {
var form = items[i];
var formId = item.getId();
var formLabel = item.getLabel()
if (itemLabel == lblForm) {
//Check the current form is the same form to be redirected.
if(itemLabel != formLabel) {
//navigate to the form
form.navigate();
} //endif
} //endif
} //end for
} //endif
} //endif
} //end function
If there is a way to display a more detailed error message, I would be greatful run it to help diagnose more.
Thanks for your help!