Logo

Power Automate

Send Document Template in email as PDF

The Challenge

One of our clients needs to send the records of the sub-grid as a pdf in the email to all the respective ones.

The Solution

For achieving the given requirement, we have created a Document Template in Dynamics 365 Sales and then send that Document Template in email as PDF from Power Automate Flow:

Approach:

We have created a Power Automate Flow in which we have performed the below steps:

  • Getting the record of the entity on which, the required field is updated.

  • Fetch required Document Template.

  • Then we have invoked POST HTTP request to Export PDF Document bypassing document Id and selected record.

  • Then we have parsed the JSON in the required format.

  • Then in the array variable of attachment, we have passed that parsed JSON as content bytes.

  • Then we have sent the created pdf as an attachment to the respective person via email.