Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

SendEmailFromTemplate with datafield through web api

Posted on by Microsoft Employee

Hi. I'm trying to send an email through web api using the action SendEmailFromTemplate and I need passing data fields to replace in template. I'm sending a json like this:

{

      "TemplateId": "0B57FBB1-9C28-E911-A95E-000D3ABA65FD",
      "Regarding": {
            "accountid": "46d64005-4231-e911-a960-000d3aba6189",
            "@odata.type": "Microsoft.Dynamics.CRM.account"
      },
      "Target": {
      "email_activity_parties": [
            {
                  "partyid_systemuser@odata.bind": "/systemusers(4adb50e5-72bd-40a8-8021-d23c6462f32d)",
                  "participationtypemask": 1
            },
            {
                  "participationtypemask": 2,
                  "partyid_eve_inquilinos_reserva@odata.bind": "/account(293f3a4e-8b30-e911-a95e-000d3aba65fd)"
            }
      ],
      "@odata.type": "Microsoft.Dynamics.CRM.email"
      }
}

This json works fine and I send an email, but if I want sending data field to replace in template. Where do I have to put the data field in the json? Inside the target section? What format should it take? Is it possible this action?

Thanks

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SendEmailFromTemplate with datafield through web api

    Thank you Rawish. I referenced the record in "Regarding" section and it works

  • Verified answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: SendEmailFromTemplate with datafield through web api

    Hi Adrian,

    Afaik , you dont need to set those fields - they are dynamics.

    as soon you send email using template - all those values are taken from the "Regarding" field record of the email which is being sent.

    are you seeing anything different?

    P.S

    if you have not - you have to go to the email template and add those field reference dynamically.

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans