Hi Experts,
I am getting the below exception while adding the lookup item to the party list of Appointment entity, the below java script function calls onChange of lookup (location- Contact), and also you can see the below screenshot on the same.
It would be great if you can provide the solution for this.
"LOOKUP CONTROL ERROR: Cannot add item of typename= to the lookup control- Dynamics 365"
function locationOnChange(){
var party = Xrm.Page.getAttribute("requiredattendees");
var partyList = party.getValue();
var newParty = Xrm.Page.getAttribute("requiredattendees");
var partlist = new Array();
for (var idx = 0; idx < partyList.length; ++idx) {
partlist[idx] = new Object();
partlist[idx].id = partyList[idx].id;
partlist[idx].name = partyList[idx].name;
partlist[idx].entityType = partyList[idx].type;
}
var ContactlookupObject = Xrm.Page.getAttribute("new_location");
if (ContactlookupObject != null) {
var ContactlookUpObjectValue = ContactlookupObject.getValue();
if ((ContactlookUpObjectValue != null)) {
partlist[partyList.length] = new Object();
partlist[partyList.length].id = ContactlookUpObjectValue[0].id;
partlist[partyList.length].name = ContactlookUpObjectValue[0].name;
partlist[partyList.length].entityType = 2;
}
}
newParty.setValue(partlist);
}
Thanks
Srikanth