Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Open an Email Template after click on a button

Posted on by 932

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

  • RE: Open an Email Template after click on a button

    Thanks but when i am going use the same template then it shows only Subject and From.

    While i already added some fields in the template.

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Open an Email Template after click on a button

    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.

  • RE: Open an Email Template after click on a button

    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 );

    }

    }

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Open an Email Template after click on a button

    Hi shakti,

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

  • Verified answer
    RE: Open an Email Template after click on a button

    parameters["templateidtype"] = "template";

    What is the templateidtype?

    Is it about entity?

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Open an Email Template after click on a button

    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.

  • RE: Open an Email Template after click on a button

    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?

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Open an Email Template after click on a button

    Hi Shakti,

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

  • Suggested answer
    Sreevalli Profile Picture
    Sreevalli 3,256 on at
    RE: Open an Email Template after click on a button

    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.

  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Open an Email Template after click on a button

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans