Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

How to set default regarding in email activity by java script

$
0
0

Hi,

I created button and when click on this button, it open new email activity from the custom entity. It is working fine.  I could set default subject but I could not set default regarding.  Please find below the java code. It is displaying correct id and name on alert message but it give error when set regarding value.  Please verify the code and find solution.

function sendmail()
{
var lookupData = new Array();
var lookupItem= new Object();
lookupItem.id = Xrm.Page.data.entity.attributes.get("new_accountid").getValue()[0].id;
alert(Xrm.Page.data.entity.attributes.get("new_accountid").getValue()[0].id);
lookupItem.typename = "account";
lookupItem.name = Xrm.Page.data.entity.attributes.get("new_accountid").getValue()[0].name;
alert(Xrm.Page.data.entity.attributes.get("new_accountid").getValue()[0].name);
lookupData[0] = lookupItem;

 


var parameters = {};
parameters["subject"] = "Sales inquiry from Customer," + " " +  Xrm.Page.data.entity.attributes.get("new_accountid").getValue()[0].name;
parameters["regardingobjectid"] = lookupData;

Xrm.Utility.openEntityForm("email",null,parameters);

 

}


pnoushu@hotmail.com


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>