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 :
Microsoft Dynamics CRM (Archived)

Open an Email Template after click on a button

(0) ShareShare
ReportReport
Posted on by 958

Hi All,

I have field Test(Two Options) and i want to send an mail when the same field is true and then i have a ribbon button named escalate.

So after click on that button i want to open an email template?

Is there any possibilities to do the same using java-script?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Pawar Pravin  Profile Picture
    5,237 on at

    Hi Shakti Singh Rajput,

    Let me correct if I'm wrong. I believe you want to open popup email activity with email template on button click.

    If that is the case you need to use custom actions to open created open activity.

    1. Create JS on button click to call action

    2. Inside action pass objecttypecode and entity logicalname

    3. In Custom action create email record and return created email GUID to js so that you can open email activity (Use email template to instantiate it)

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    Hi Shakti,

    help me understand it better. So basically as soon as anyone click on that button you basically need to open a new email form? then user enters "to" "from" subject etc?

    to do this you can simply use open form request : docs.microsoft.com/.../openform

    or open url request in which you can open a default new email url : docs.microsoft.com/.../openurl

  • Suggested answer
    Sreevalli Profile Picture
    3,256 on at

    Hi,

    If I understand you correctly on button click, you want users to select Email Template, like insert email template in email description page.

    Its an I frame, needs to be opened pass the below source in IFrame and open HTML with the Iframe on button click. _grid/cmds/dlg_bulkemail.aspx%3Fbulkemail=false&dType=1&objectId=%257bA16B3F4B-1BE7-E611-8101-E0071B6AF231%257d&objectTypeCode=1


    Pass your record Guid and object code.

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Shakti,

    It would be good if you could provide more details on your requirement.

  • Shakti Singh Rajput Profile Picture
    958 on at

    Okay,

    So I have a custom "Case Escalate" field and a custom button on the form named "Escalate".

    When the value of Case Escalate is true then click on Escalate button through which i want to open a Email template to send an mail internally?

  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    I did a quick google search on the text "dynamics 365 create email from email template javascript" and found the following topis- Take a look if it helps-

    Threads with similar requirements-

    community.dynamics.com/.../206340

    community.dynamics.com/.../246539

    community.dynamics.com/.../112803

    You can also create a custom action, which calls a custom workflow activity (C#) and create the email from template. You can then call that custom action from JS using your ribbon button. Refer these links-

    docs.microsoft.com/.../sample-create-email-template

    mscrmmindfire.wordpress.com/.../how-to-append-email-template-to-email-entity-form-on-load-through-javascript

    www.daisychubb.com/.../creating-an-email-with-template-in-ms-dynamics-crm-2016

    Hope this helps.

  • Verified answer
    Shakti Singh Rajput Profile Picture
    958 on at

    parameters["templateidtype"] = "template";

    What is the templateidtype?

    Is it about entity?

  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi shakti,

    Sorry but again you are asking question without context. O have shared 6 links above with dofferent approaches. Which were you referring?

  • Shakti Singh Rajput Profile Picture
    958 on at

    This is done, thanks for help.

    One more thing want to know i added some fields in body of that template.

    So how could i pass them?

    Code is given below--->

    function LoadTemplate() {

    // Check the form type should be 'create' type

       var unit = Xrm.Page.getAttribute("new_first_escalation").getValue();

       if(unit==true)

       {

    var parameters = {};

    parameters["templateid"] = "2c2c7d8d-2813-e911-a969-000d3af03194"; // Guid of Email Template

    parameters["templateidname"] = "Case Escalation";

    parameters["_CreateFromType"] = "112";

    /*parameters["body"] = "<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl="www.w3.org/.../Transform&quot; version="1.0"><xsl:output method="text" indent="no"></xsl:output><xsl:template match="/data"><![CDATA[]]><xsl:choose><xsl:when test="incident/title"><xsl:value-of select="incident/title" ></xsl:value></xsl:when><xsl:when test="incident/new_timerstatus"><xsl:value-of select="incident/new_timerstatus" ></xsl:value></xsl:when><xsl:when test="incident/new_first_escalation/@name"><xsl:value-of select="incident/new_first_escalation/@name" ></xsl:value></xsl:when><xsl:otherwise></xsl:otherwise></xsl:choose><![CDATA[ <font face="Tahoma, Verdana, Arial" size=2 style="display:inline;"></font>]]></xsl:template></xsl:stylesheet>";*/

    var windowOptions = { openInNewWindow: true};

    parameters["subject"] = "Regarding Case Escalation ";

    //parameters["templateidtype"] = "template";

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

    }

    }

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Are you asking about adding fielda in the template? Or passing some dynamic values to the template.

    www.magnetismsolutions.com/.../Adding_Dynamic_Fields_from_Lead_Contact_E-Mail_Templates_to_Global_Templates.aspx

    Also, if you have got the answer of your main question then please close this thread and open new for this question to get suggestion from other members as well.

    Hope this helps.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans