Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

CRM 2015: Pull new form on change of object

$
0
0

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!


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>