Hello,
I am not able to set lookup field value when writing the below code. I am getting the error that "Uncaught ReferenceError:Xrm is not defined". I have also added XrmServiceToolkit and ClientGlobalContext.js.aspx but still getting the same error. Please provide the solution if possible.
var recordname = $("#SelectEntityPrimaryName").val(); var recordnamevalue = $("#SelectEntityPrimaryName option:selected").text(); var primaryrecord = new Array(); primaryrecord[0] = new Object(); primaryrecord[0].id = recordname; primaryrecord[0].name = recordnamevalue; primaryrecord[0].entityType = "new_event"; Xrm.Page.data.entity.attributes.get("regardingobjectid").setValue(primaryrecord);