Skip to content

Instantly share code, notes, and snippets.

@jagsbyteinception
Last active July 25, 2021 20:05
Show Gist options
  • Save jagsbyteinception/3ca104b5510d8c64e6dd1b60077c912d to your computer and use it in GitHub Desktop.
Save jagsbyteinception/3ca104b5510d8c64e6dd1b60077c912d to your computer and use it in GitHub Desktop.
//https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/258887/sending-unique-email-via-web-api-crm/728165
/*
otherlinks: https://community.dynamics.com/365/f/dynamics-365-general-forum/359828/execute-sendemailfromtemplate-web-api-action-from-js
*/
//-- /api/data/v8.2/emails
//Method: POST
{
"subject": "Email demo from Web API",
"description": "This is the description text",
"regardingobjectid_contact@odata.bind": "/contacts(e01dc812-f2c5-e711-8119-e0071b66e2e1)",
"email_activity_parties": [
{ "partyid_queue@odata.bind": "/queues(23bba18a-35c4-e211-411e-e0071b65be92)", "participationtypemask": 1 },
//{ "partyid_systemuser@odata.bind": "/systemusers(23bba18a-35c4-e211-411e-e0071b65be92)", "participationtypemask": 1 },
{ "partyid_contact@odata.bind": "/contacts(e01dc812-f2c5-e711-8119-e0071b66e2e1)", "participationtypemask": 2 }
]
}
//And then the ID for the new created email get used in the next Action, SendEmail.
///api/data/v8.2/emails(insert-guid-of-created-email)/Microsoft.Dynamics.CRM.SendEmail
//Method: POST
{
"IssueSend": true
}
/*
related:
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/use-web-api-actions
https://butenko.pro/2018/03/02/how-to-use-sendemailfromtemplate-action-with-javascript-and-webapi/
https://vblogs.in/create-and-send-email-using-web-api-in-d365-cecrm/
https://stackoverflow.com/questions/47450856/dynamics-365-web-api-email-send
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment