Outcome and benefits: In this blog post, we will set the image on Contact records withing D365 using the Twitter connector for Microsoft Power Automate. This integration will allow us to save time by significantly reducing the effort that users spend uploading images to D365. The user only needs to provide Twitter account details to update the record in D365.
Microsoft Power Automate
Microsoft has been investing in several cloud-only integration solutions for their existing Office apps. The most popular among these is Microsoft Power Automate, which is a trigger-based system for creating automated workflows.
Microsoft Power Automate is relatively easy to use as it does not require advanced technical knowledge. It gives you the kind of automation for notifications, alerts, data gathering, and communication that will help you spend less time on tedious tasks and more time on other productive activities. Another good thing about Microsoft Power Automate is that it is free to use if you sign up with your Microsoft account. People who are already using Office 365 can use Power Automate for free as well.
If you want to utilize more functionality, then you can sign up for a paid plan. Here are the options that you can choose from:
Power Automate Plan Options
Power Automate Free: with the free plan, users can generate unlimited flows. But can only execute 750 runs per month. Additionally, the free plan only allows you to run automatically every 15 mins.
Power Automate Plan 1: The user can utilize this plan for $5 per month and can execute 4,500 runs a month. The interval is also lowered to run every 3 minutes.
Furthermore, you also get premium connectors to popular services like MailChimp and Salesforce.
Power AutomatePlan 2: Users opting for this plan, priced at $15 per month, get 15,000 runs, and the interval is reduced to check every minute. In addition to everything offered by Power Automate Plan 1, the user also gets access to organization policy settings, and several business processes flow.
If you want to start a trial before signing up for a subscription, then you can sign up for a free trial for 90 days to allow yourself to get familiar with Microsoft Power Automate.
There are several ways to start a flow. Below are the currently supported methods.
Automated: When we need to trigger a flow automatically whenever an event occurs, like an email arriving, a file change, or a field change within Dynamics.
Button: When we want the flow to be triggered manually by clicking a button.
Scheduled: We run the flow at a set time, either once or as a recurring action.
Power Automate already has numerous connectors for applications, including most Microsoft applications with a SaaS Interface (Including GitHub). Additional connectors include Dropbox, Slack, Gmail, MailChimp, Twitter, Jira, Basecamp, and many more. The connectors are classed into two categories. Connectors in the Limited category are only available for Premium users, but the majority of those are for enterprise services like Salesforce and Bitbucket. Connectors are not limited to just business applications but are also available for base technologies such as RSS and FTP. The whole family of connectors consists of 323 applications and protocols as of right now. A user can even write their own if a connection is needed for an application that is not in the current list of connectors.
Steps to Configure Microsoft Power Automate to set the Contact record Image in D365 from Twitter.
Step 1: Log in to Microsoft Power Automate, and you will see this:
Step 2: Once logged in, you will then go to My Flow and click on “Create from blank”.
Step 3: After that, we will select “When a record is created”, as highlighted in the image given below.
Step 4: Now, we will select the “Entity name” that we need to use in this case. We are using Contact.
Step 5: Next, we will use the connector of “Get record” to get the data of the records.
Step 6: Moving on, we will connect it to Twitter and use “Get User” to collect the information related to Twitter Profile, as highlighted in the image given below.
Step 7: Now, we will provide the Twitter “Username,” which we will get from the previous Step “Get record.” In this case, the custom field titled Twitter is utilized.
Step 8: Now, we will utilize “OneDrive for Business” to store the image with the help of the “Upload file from URL” connector for its further utilization.
Step 9: We will then provide the required field for storing the image. In this case, “Source URL and Destination File Path” and the values of these fields. The fields are taken from the previous step, which is “Get user,” as shown in the image below.
Step 10: After that, we will use the “Get file content” to get the content of the file that we have uploaded to OneDrive in the previous step.
Step 11: After that, we will use the “Update a record” to identify and update the records. We will utilize the previous step (“Get record”) values.
Step 12: Now, we will use the expression to provide the appropriate formatted value to the Entity Image field. The expression that we are going to utilize is given below.
Let me break it down even further to make it easy to understand. We will get the body using this: “body(‘Get_file_content’)”. In this, we will use the previous step ‘Get file content’. After that, we will get the content by using this ‘[‘$content’]’. Once we get the content, we will convert it to the appropriate format using ‘base64ToBinary’. After that, we will place it in the appropriate field. In this case, we will use “Entity Image,” as shown in the image given below.
Step 13: Later, we will delete the file from the OneDrive using “Delete file” and provide the required field in this case “File” from the previous step “Upload file from URL” with the ID from this step, as shown in the image.
Step 14: Now, we will click the “Save” button at the top so we can use it.
Testing the Flow
Step 1: Now, we will create a Contact record to trigger the flow, as shown below.
Step 2: Once we have performed the previous step, we will see the Flow history, and it will show that flow has been completed successfully. It will also tell us the time distribution that each Step takes to complete, as shown in the image given below.
Step 3: After the Flow is completed, we can see that the Contact record contains the image derived from the Twitter profile. The image is later provided in the Twitter field in the record as shown in the image given below.
In this blog post we have learned that we can set the image on a Contact record within Dynamics 365 using information provided by the user and pulled in from Twitter using Microsoft Power Automate with Dynamics 365. I hope this blog will prove to be quite helpful. If you have any questions or insights, please leave a comment below!