From an Email, I want to retrieve a custom lookup field ("new_manager") from the regardingobjectid (incident) and set the value as a recipient on the email.
Trying to run debugger and it seems it doesn't even fire the successcallback function "setManager".
Any help would be appreciated.
//SET MANAGER TO EMAIL RECIPIENT function retrieveManager(regardingobjectId) { if(!Xrm.Page.getAttribute("regardingobjectid").getValue()) return; var regardingobjectId = Xrm.Page.getAttribute("regardingobjectid").getValue()[0].id; var EntitySchemaName = "Incident"; if (regardingobjectId.entityType == "incident") { SDK.REST.retrieveRecord( regardingobjectId, EntitySchemaName, "new_manager", null, setManager, errorHandler); } } function setManager(incident) { debugger; var manager = incident.new_manager; if (manager != null) { var partlistData = new Array(); partlistData[0] = new Object(); partlistData[0].id = manager; partlistData[0].name = manager.name; partlistData[0].entityType = "systemuser"; Xrm.Page.getAttribute("to").setValue(partlistData); } } function errorHandler(error) { alert(error.message); }
*This post is locked for comments