Hi,
I'm new to JScript and I'm struggling with getting the correct result.
Below is code I am using to retrieve the value to the aml_ParentAccount lookup field. I have been researching and trying different scenarios for the last 3 days with no avail. I have even tried all lowercase, but also to no avail.
I am trying to set the variable Acct with the value in aml_ParentAccount. I have commented out the different scenarios I have tried, and the errors they return.
I have uploaded a screen shot of the field name to prove that I am spelling it correctly.
Can anyone help advise what the correct code is to retrieve the value from the aml_ParentAccount lookup field.
function concatTitle() { var Title = Xrm.Page.getAttribute('aml_name').getValue(); // Works - Returns the text value or null if empty. debugger; // To pause code // var Acct = Xrm.Page.getAttribute('aml_parentaccount').getSelectedOption(); // var Acct = Xrm.Page.getAttribute("aml_parentaccount").getSelectedOption(); // Errors - Returns "Object doesn't support property or method 'getSelectedOption'" // var Acct = Xrm.Page.data.entity.attributes.get('aml_ParentAccount').getValue(); // var Acct = Xrm.Page.data.entity.attributes.get("aml_ParentAccount").getValue(); // Errors - Returns "Unable to get property 'getValue' of undefined or null reference" // var Acct = Xrm.Page.getAttribute('aml_ParentAccount').getValue(); // var Acct = Xrm.Page.getAttribute("aml_ParentAccount").getValue(); // Errors - Returns "Unable to get property 'getValue' of undefined or null reference" // var Acct = Xrm.Page.getAttribute('aml_ParentAccount'); // var Acct = Xrm.Page.getAttribute("aml_ParentAccount"); // Errors - Returns back null, regardless if there is a value or not. var TrialID = Xrm.Page.getAttribute('aml_clientprotocoltrialid').getValue(); // Works - Returns the text value or null if empty. }
*This post is locked for comments