Disclaimer: New for JavaScript
Form : MyForm
Fields :
ntt_name ntt_lookup1 ntt_lookup2
Demand
Read the value of ntt_lookup1 and ntt_lookup2 and get the name (not the identifier) ββand combine them and fill it in the name field (primary attribute).
I load this as a web resource, bind it to the MyForm form and add it to the onsave event.
I get the following error.

Question : What am I doing wrong?
What i have done so far :
- A Google search error occured and found this question . Thus, double is checked for missing parentheses, using both Notepad ++ and manually tracking it manually.
Code
if (typeof(CRMDynamics2011) == "undefined") { CRMDynamics2011 = {}; } CRMDynamics2011.MyForm = { FormSave: function() { alert("Within Function FormSave"); var lookup1 = Xrm.Page.getAttribute("ntt_lookup1").getValue(); var lookup2 = Xrm.Page.getAttribute("ntt_lookup2").getValue(); if (lookup1 != null && lookup1[0] && lookup1[0].name != null) { alert("lookup1 is NOT NULL"); var value1 = lookup1[0].name; } if (lookup2 != null && lookup2[0] && lookup2[0].name != null) { alert("lookup2 is NOT NULL"); var value2 = lookup2[0].name; } var fieldName = Xrm.Page.getAttribute("ntt_name"); fieldName.setValue(value1 + ' - ' + value2); } };
source share