In phone call screens, when user key in "RECIPIENT", i want to assign the recipient value into my regarding field. I use coding as below but keep fail.
function Regarding() {
var existingto = Xrm.Page.data.entity.attributes.get("to");
if(existingto.getValue()!=null){
var existingtoGUID = existingto.getValue()[0].id;
var existingtoName = existingto.getValue()[0].name;
SetLookupValue("RegardingObjectId",existingtoGUID,existingtoName,"account");
}
}
function SetLookupValue(regardingobjectid,id,name,entityType){
if(regardingobjectid!=null){
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = id;
lookupValue[0].name = name;
lookupValue[0].entityType = entityType;
Xrm.Page.getAttribute(regardingobjectid).setValue(lookupValue);
}
}
Is there anyone can help what is my problem of coding ...? Thanks a lot..
*This post is locked for comments