web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

MS CRM 2011/2013: Open new email form with To and Regarding fields prefilled

a33ik Profile Picture a33ik 84,331 Most Valuable Professional
About a year ago I wrote small article how to open new activity form with Regarding field prefilled.
This week I had a similar task but this time I had to write a JavaScript that will open email form with To field prefilled. So here is the script that you can use:
function OpenEmail(recordid, recordtypecode) {
var params = "pId=" + recordid + "&pName=&pType=" + recordtypecode;
params += "&partyid=" + recordid + "&partyname=&partytype=" + recordtypecode;
var url = "/main.aspx?etc=4202&pagetype=entityrecord&extraqs=" + encodeURIComponent(params);
url = Xrm.Page.context.prependOrgName(url);
window.open(url);
}

Here is sample of usage:

OpenEmail("c8576fa9-155e-e311-bbc5-6c3be5a8d218", 2);

This small JavaScript will open new email form with Regarding and To fields prefilled with contact with Id that equals to "c8576fa9-155e-e311-bbc5-6c3be5a8d218".

This was originally posted here.

Comments

*This post is locked for comments