kugghjul i ett moln

Using Power Apps portal, Power Automate and Dynamics 365 CRM to solve real customer requirements

Working with Dynamics 365 and Power Platform design and development? Then keep reading. In this blog post I will show you the power of Dynamics 365, Power Apps portal and Power Automate together and I will also demonstrate the low code solution for complex integrations by using Power Automate.

Process overview

process overview

The process starts by the external users that are not Dynamics 365 users. The users click on a link that they get through emails or events. Power Apps portal checks the user’s security number and gets the address and other relevant information from Dun&Bradstreet (Bisnode) by invoking Power Automate through web forms. If the users pass the validations and the information entered in the web forms are correct, then the users will be added as project members in Dynamics 365 CRM. The link that the users receive is shortened by Bitly through Power Automate connector.

Customer Request:

  • Based on the case entity in Dynamics 365 create a unique link for the case record.
  • Shorten the created link and save both the original link and the shortened link as field values in the case entity.
  • The original link must be created based on a button on the main form on the case entity and the button should be enabled for a specific case type and specific security rules.
  • It must be possible to activate and inactivate the link based on a checkbox field on the case main entity.
  • The Power Apps users are not Dynamics 365 users, they are considered as external users.
  • The information gathered from Power Apps portal during the registration process will be used to create project members (a custom entity related to case entity).
  • The data added by Power Apps external users must be validated and some fields need to be required only on the Power Apps Portal but not in Dynamics 365.
  • The Power Apps external users need to add the required data in steps, and they must be able to go back to previous step and start again.
  • The data from Power Apps portal must only be added to Dynamics 365 when all the predefined conditions are met.
  • Based on the Power Apps external user’s Swedish security number, get all the user details from Dun&Bradstreet and present the information to the user to check and change before submitting the data to Dynamics 365.
  • Validate that the security number is valid before getting the user data from Dun&Bradstreet.
  • General Data Protection Regulation (EU GDPR) must be followed, if the users do not go through all the steps, the data used in the steps must be nulled once per day. If the user goes through all the steps, all the information used in the steps must be nulled after the submission.

Tools, apps and programming languages used to fulfill the customer requirements:

  • Dynamics 365 CRM
  • Power Apps portal
  • Power Automate
  • Dun&Bradstreet
  • Bitly
  • JavaScript/jQuery
  • TypeScript (Converted to JavaScript)
  • Liquid
  • HTML
  • Microsoft Page_Validators for client-side validation for Dynamics 365 Portal
  • Power Apps Portal Web API CRUD Operations
  • Power Apps Portal Web forms (Advanced forms)
  • XrmToolBox, Ribbon Workbench
  • XrmToolBox, Portal Record Mover

The core components in Dynamics, Power Apps portal and Power Automate used to fulfill the customer requirements

I started the process in Dynamics 365, below the list of new components that I created in different systems.

Dynamics 365

Original link is a text field that will hold record of the unique link in Dynamics 365 case (incident) entity. The link holds the GUID for the case entity and it is used by Power Apps portal to find the case in Dynamics 365.

Shortened link is also a text field in the case entity, which will hold the link created in Bitly, and the Power Apps external users will get this link via events or emails. When the users click on this link it will go to the original link. Note: when we say users, we mean Power Apps external users.

ActivateOrDeactivate field, this is a two optionset field in the case entity that is used to activate and deactivate the original link in Power Apps portal. A Power Automate is triggered once this field is updated in the case entity.

To integrate the Power Apps portal with Dynamics 365, I created a new entity (Link Entity), which holds some important information such as the information gathered from Power Apps portal during the registration process before submitting to Dynamics 365 and information about the case linked to the information gathered during the process.

The custom link entity holds some important fields: Case incident Id (GUID), Case original link, Does not exists in Dun&Bradstreet, Protected Identity, Dun&Bradstreet errors, Security Number, Inactivate the link, Plus many other fields to gather the personal information for the registration process such address, names, phones, email etc.

A new button (Create access link) on the main Case form. The button was created by Ribbon Workbench. Once clicked a new record is created in the new custom link entity. The code behind the button is based on TypeScript, which we are using in this project, but JavaScript can also be used.

A new main form for Power Apps portal web form with tabs was created in Dynamics 365. The tabs are used as web form steps in Power Apps portal.

Power Automate (Flows)

A Power Automate will trigger when the field ActivateOrDeactivate in the case entity is updated. If the value is true, the field “Inactivate the link” in the link entity is set to true. If the value is false, then “Inactivate the link” is set to false. On the Power Apps portal web form, we check this field value and if it’s true we will proceed with the registration, but if not, we will tell the external user that the link is inactive.

A Power Automate triggers directly from the advanced form, also called web form “Form Options” in the JavaScript/jQuery section. We need to invoke the flow directly to get the details from Dun&Bradstreet to the web form in real time. The flow is triggered when a HTTP request is received.

In, I created a new flow with the trigger “When a HTTP request is received”. The input for the flow had three fields and I used the Json below in “Use Sample payload to generate schema” to generate the input as objects.

”securityNumber”: ”value”,
”linkEntityId”: ”value”,
”caseOriginalLink”: ”value”

”value”, this is to indicate to the payload generator that it is a string json element. You can use which value you want here. For example, ”test” will also be considered as a string. You can also use an empty string like this, ”securityNumber”: ””, it will also work.

As explained above, the Power Automate will have 3 inputs in this case.

http request

The code to invoke the Power Automate has been written in web form “Form Options” for the step used in that regard.  Note: the code starts with “$(document).ready(function(){“ because it is written in jQuery.

from options javascript

Here you can have your code and call other functions.
In this case we are getting values for securityNumber, linkEntityId and doing other stuff and after that we call the function callFlow to trigger the Power Automate in Power Platform.
callFlow(securityNumber, LinkEntityId, caseOriginalLink);
Note: We had three inputs for the flow, so we are sending the values for the three inputs in Power Automate.

How to call the flow from web form “Form Option” with jQuery directly, see below:

from options custom javascript

function callFlow(securityNumber, linkEntityId) {
var caseOriginalLink = We are getting the case original link
//We are creating a json string here, which will be the input for the Power Automate flow.
Var httpTriggerUrl = your HTTP Post URL from the Power Automate

http post url

var objDun&BradstreetSearch = {};
objDun&BradstreetSearch.securityNumber = securityNumber;
objDun&BradstreetSearch.linkEntityId = linkEntityId;
objDun&BradstreetSearch.caseOriginalLink = caseOriginalLink;
var stringJSON = JSON.stringify(objDun&BradstreetSearch);
url: httpTriggerUrl,
contentType: ”application/json; charset=utf-8”,
type: ”POST”,
async: false,
dataType: ’json’,
contentType:”application/json; charset=utf-8”,
data: stringJSON
.done (function(data, textStatus, jqXHR) {
// Do your Done stuff here
.fail (function(jqXHR, textStatus, errorThrown) {
// Do your fail stuff here

.always (function(jqXHROrData, textStatus, jqXHROrErrorThrown) {
// Do your always stuff here


In our case, the most important task is to invoke the Power Automate with the inputs in real time and in the Power Automate steps to update the custom Link entity with real data from Dun&Bradstreet. After that we need to show the result for the user in the web form step in real time. The time was an important factor, the user should not wait for more than a few seconds. The Power Automate will need to search for the user’s security number in Dun&Bradstreet through the HTTP request in Power Automate and based on the response from Dun&Bradstreet update the link entity.

  • A Recurrence Power Automate runs every day on 06:00 AM to nullify the fields in the custom link entity that it is used by web forms steps. This is done just in case Power Automate external users don’t follow all the steps to the end, so therefore we need to nullify the information to meet the GDPR requirements. Power Apps portal web forms use sessions, so this Power Automate checks the sessions created the day before and gets the primary entity Id for the link entity from the session and based on that Id updates (nullifies the fields) the Link Entity.
  • Another Power Automate will trigger when the field original link on the case entity is updated. This will create a link in Bitly for the original link and after that update the shortened link field in the Case entity. I am using the Bitly connector for Power Automate.

connector name

  • The last Power Automate adds the users as project members in Dynamics. This Power Automate is also triggered from the web form’s last step as JQuery in “Form Options”. How to trigger the Power Automate automatically from web forms is explained above. This one has many inputs but everything else is the same.

Power Apps portal

To fulfill the requirements, I created three pages, a list and two web forms (advanced form).

A landing page:
When Power Apps external users click on the link that they get through emails or events, it will open this page in the Power Apps portal. This is the same link that is saved in the case entity field “Original link”. The landing page can be opened either by the “Original link” or the “Shortened link” (Bitly link). The landing page is using a web form (advanced form). This web form is validating the field “Inactivate the link” on the link entity. If the value is true, which means it is active, it goes to the next web form to follow the registration steps, but if it is false, it will go to a page saying that the link is not available anymore and that they can contact us. The validation is done through “Form Options” on the web form step on the ”Link control webform” web form.

A list:
A new list shows all the active links in the Link entity. The landing page opens the record based on the field name in the custom link entity. The field name holds the same value as the link (Original link) from the case entity. When opening a record in the list, it will open the web form “”Link control webform”. This web form is used to control if the link is active or inactive. As I also mentioned before, each link has a unique GUID for the case that is used to find the case in Dynamics for the updates through the web form steps.

Two web forms:

  • Link control web form
  • Registration of interest web form

When the Power Apps portal external users open the link, they have received, it will first go through the web form ”Link control webform” which is linked to the list in Power Apps portal. As mentioned under the list section above, it will validate the link and if active it will go to the next web form, ”Registration of interest webform”. This web form has many steps, and it uses Form Options sections for each step to do validations and invoke Power Automate processes as mentioned above.



  • Kanfar Donardi

    Dynamics 365 and Power Platform Solution Architect and Developer