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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Button to open an email with pre-populated look up fields

(0) ShareShare
ReportReport
Posted on by 22

Hi, I'm new to CRM customization and JavaScript, and am hoping I could get some help from experts here:

The goal here is to:

1. Have a button on a form of the Ticket entity. 

2. When the button is clicked from a ticket, a new Email form will show up in a new window with pre-populated fields including 'From', 'To', 'Regarding', and 'Description'

3. In the new email form - 'To' refers to the customer; 'Regarding' refers to the ticket title; 'Description' needs to include a default email template; all fields except 'Description' are look up fields.

4. the form should look like below:

7534.123.JPG

I've found various articles online and this seems to match my goal the most -  https://community.dynamics.com/crm/f/117/t/273017

I've also created a customized button and was able to publish my first Jscript passing string values from the Ticket entity.  However, I'm having trouble populating all the look up fields and inserting an email template (To, Regarding, Description); The syntax I'm using is Xrm.Utility.openEntityForm(name,id,parameters,windowOptions) and below is what I've had so far:

function CreateNewEmail()
{
//Get lookup value from Form to open the entity form
var regarding = Xrm.Page.data.entity.attributes.get("title").getValue();
var regarding = Xrm.Page.data.entity.attributes.get("incidentid").getValue(); // this line seems incorrect?

//Open a new window
var windowOptions = {
openInNewWindow: true
};

//Pass paramenters
var parameters = {};
parameters["subject"] = regarding;
parameters["formid"] ="000AA4A1-11AA-1234-ABCD-12345678ABCD";
parameters["regardingobjectid"] = regardingobjectid; // this line seems incorrect?

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

 

Also, if I click an existing ticket - go to timeline - click Activities tab and select 'E-mail', then the page would go to an email form with the all the pre-populated fields I'm looking for; however I would need the email form to show up in a new window and it seems like the timeline tab is an OOB feature and thus I am not sure if I could customize this part of the form?

One last thing - not sure if there is a better way to open a new email form in a new window rather than clicking a customized bottom on a ticket form.  Any recommendation is welcome.  Thank you all in advance :)

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Joanna Chong Shen Profile Picture
    on at

    Try:

    parameters["regardingobjectid"] = Guid of that ticket;

    parameters["regardingobjectidname"] = Name of that ticket;

    parameters["regardingobjectidtype"] = entity name of ticket;

    Additionally, if you're on v9.X, try out the new libraries. https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation/openform

    If helpful please marked as verified answer. 

  • Suggested answer
    Pawar Pravin Profile Picture
    5,237 on at

    Hi Kole Huang,

    I have tried same approach on CRM online and unfortunately using js its not working. I would suggest you to open email record with the help of JS and custom action.  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans