Power Automate is a service that helps you create automated workflows between your favorite apps and services to synchronize files, get notifications, collect data, and more. Today we will see how we can convert a note in CRM from word to pdf with Common Data Service Connector.
Lets login to Power Automate and create a new solution:
Once the solution is created, we can start creating the flow by clicking on New Flow:
Select ‘When a record is created, updated or deleted’:
We will now add the trigger for creation of notes for account:
Next, we will check whether entity is ‘Account’ and the document is a word document so we can convert it to pdf.
Below are expressions to check word document.
Since we will convert the document using ‘OneDrive For Business’ connector, so the first action will be to create a file in ‘OneDrive for Business’.
We can use the same file name from the notes file but for file contents we need to convert from base64 string to binary by using this formula base64ToBinary(triggerOutputs()?[‘body/documentbody’]).
We will now convert the file to PDF using ‘OneDrive for business’ connector:
Since the PDF is now generated, we will add this PDF in CRM as a new note.
We will set the following fields for creating the pdf note:
Title: Give the title of the note. It can be any string value.
Description: Give a description of the note. Can be any string value.
File Name: Give the name of the file.
Document: We have used body(‘Convert_file_to_pdf’)[‘$content’] expression.
Mime Type: We have used body(‘Convert_file_to_pdf’)[‘$content-type’] expression.
Similarly, please also note the format used for Regarding (Accounts). We will add regarding Account in this field.
Since we have created the pdf file in our CRM with a new note in the above step. So, we don’t need the file on OneDrive. That’s why we can now delete the file created in OneDrive:
As a last step, we can also delete the original note from CRM:
The complete list of steps should be like this:
Now, lets create a note in CRM by uploading a word document:
However, after a few seconds when our flow will run the document will be converted into pdf
we have now successfully converted the word file to pdf using Power Automate.
For questions or insights, leave a comment below or reach out to us at email@example.com. We are always happy to help.