In this blog, I will tell you how to generate a QR code/bar code in Dynamics 365 CRM and how to store the QR code/bar code as an image file against a Dataverse record.
Follow the following steps to achieve this business needs.
Step 1: Prepare a Dataverse Table with Columns
Go to Power Apps, Navigate to Solutions, and choose your solution with the correct environment. Add a respective table to store the QR/Bar code.
Here Account table is used in this demo. Below is the screenshot of columns added to the account table to store the bar code/QR code. the data type is an image. Additionally, added a Token Sent Yes/No type of field to trigger the Power Automate.
Step 2: Create API Key for QR code/Bar code generation.
Now you need to use the https://www.encodian.com/ website to generate an API key to use in the Power Automate Encodian connector for QR Code generation. provide your information to generate the API Key. Once completed, the API key is sent to your email address.
Note the API key. The sample API key looks like 89965272-ba4e-46c5-b6ad-de0867ce9545.
Step 3: Configure Power Automate to generate a QR code and save it in Dataverse.
In your solution, add a new power automate and select a type as automated cloud flow. Choose Microsoft Dataverse as a Connector. Add a trigger named “when a row is added or modified or deleted”. Select the column triggering the power automate once the value is modified.
After that, Add a new action step to use connector Encodian.
Add 1st the Barcode action step and then the QR Code action step. Provide the name of the connection of your choice and provide the API key generated in the previous step.
Specify options for Barcode Type, Data you want to include in BARCODE, IMAGE Format, and Captions as you wish.
Next, add the QR generate action and follow the same procedure to supply values. Provide Barcode data and Image format.
Add a new step to store the Barcode and QR code in the Dataverse record. add connector Dataverse and add an action named “upload a file or an image”. In Table Choose Accounts, Row ID is chosen as the account record ID from the dynamic panel from the trigger step. Column name select the Barcode column to store the Barcode image. In content, select the File content option from the Create Barcode step.
Repeat the step above for the QR code store.
Now you are done.
This is the final flow.
Step 4 – Test the Power Automate
Open the Account form and update the Token sent field value as yes and you will see after some time the flow will run and attach the barcode and QR code against the record. (Make sure to publish your solution)
You can verify the Dataverse record to see if the QR and bar code are generated.