*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***
One thing I love more than anything about the D365 community is COLLABORATION! So many are willing to share ideas. From there it creates other ideas, expanding and encouraging new ways of doing things. One such collaborator is Bruce (creator of 365 Notify), and author of this awesome post about Generating Quote PDF attachments in Dynamics through Flow. I’ve used this a few times, but wanted to take it a step further, and have the PDF be emailed automatically after being created. So let’s see how we can email document templates as PDF’s.
The first step is to follow Bruce’s solution using his post in the link above. Once you’ve got that working, you will need to create a new workflow against the Note entity. We want to run it when a new record is created. Then we will do a quick conditional check to make sure the note is actually regarding a quote (regarding Quote, quote contains data), and that the title of the note equals the same title you provided when you created your Microsoft Flow.
Next, use the Create record step (selecting Email) and add the from, to and body of the email. We don’t want to send the email yet because we need to add in the pdf attachment for the quote. Make sure you set the regarding field as the quote so the email will be available for reference in the activity timeline. Next, if you aren’t already using it, download and install Dynamics 365 Workflow Tools by MVP Demian Raschkovan. This will allow you to grab the pdf and attach it to the email.
The main record URL will be the quote record. Next, use *.* in the file name field to grab the PDF file attached to the related note. In the email field, link the Email Message you created in the previous step.
Next, add a Send Email step (also using Demian’s solution). This will allow you to pick the email message you created and send it to the intended recipients. Finally, using another step from the solution, add Delete Record, and use the record URL for the note.
Now run the original workflow you created (as part of the solution Bruce outlines). You should get the following end result:
- The initial workflow adds your Word Document Template to a Note against the Quote
- This kicks off the Microsoft Flow, creating a PDF of the Word template and adding it back to your Quote record
- When the new Note is created, this kicks off the workflow you just created using the steps above
- The email is created, the PDF on the note is attached to the email, and the email is sent
- The note with the PDF is deleted so that next time you run it, there aren’t multiple notes with a PDF attached for the Quote
So, this solution uses the awesomeness created by Bruce, then sends an email, removing any unnecessary documents in Notes linked to the Quote record. Nice and clean, and seamless to the end user.
Check out the latest post:
Contact Timeline Adjustments Including D365 Marketing Interactions
This is just 1 of 345 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.