I have been looking into scenarios with PowerApps and Flow that can benefit Dynamics 365 Customer Engagement user experience. One of the scenarios that can add value right away is on the entity forms. PowerApps can be embedded as an IFrame on the normal entity forms, and can be used similar to Dialogs to offload some processing to PowerApps and Flow.
Here is the finished product.
This works without any JavaScript at all in UCI, with the normal IFrame control on the form. Make sure to tick the option that passes the record id and objecttype code and untick cross site scripting restriction.
No scripts are needed on the form to embed the PowerApp.
Once PowerApps is in place, the current form context can be inferred using the “id” parameter that is passed on to the form.
I use a known Guid during the design phase to assist me with the app design process, as the PowerApps calls the Flow during the OnStart event and sets the ProblemDetails variable.
A Flow can be associated to an event, from the Action->Flows area.
When the PowerApps loads, it calls the Flow with the Guid, to retrieve the case details. The Flow that responds to PowerApps with these details on the case: Title, Customer Name, Type of Customer (Account or Contact).
In this Flow I just use “Respond to PowerApps”action and return the three outputs.
I used variables to store the Client, which could be the Account’s name or Contact’s FullName, depending on what is on the case. The client type could be either Account or Contact. Account Details and Contact details are retrieved based on the result of the Client Type branch.
For the second Flow, the user presses the “Check” button which performs some additional checks based on business criteria. For this Flow, I used the “Response” action, which allows me to return JSON results. I stored the cases I am interested in on an array variable.
From the variable, I used Select action to grab only the properties I am interested in.
I can then use the “Response” action to return these to PowerApps.
One weird thing that I encountered in PowerApps/Flow integration, is that I would simply see the result as “True” from Flow, when I tried to return the return the response straight from the variable.
When I used Parse JSON and then Select to reduce the properties it started working. This can happen when there is something wrong with the schema validation, but I am not sure how this can happen when I copy-paste the JSON response from the previous steps to auto-generate the schema.
One more thing: When the Flow that is associated with the PowerApps changes, just make sure to disassociate and reassociate the Flow. I had issues when I did not do this, due to PowerApps caching the Flow definition.
References;
https://preview.flow.microsoft.com/en-us/blog/howto-upload-return-file/
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/get-sessionid
[…] Dreaming in CRM […]
[…] 2 : Improving entity forms using embedded PowerApps (Blog Post by MVP Natraj Yegnaraman […]
hahah did you read my mind? I was just thinking to ask you whenever I see you in office how iframe can be used to pass parameters from D365 to PowerApps. Thanks for the post! 😀
Glad to be of help.
[…] Improving entity forms using embedded PowerApps […]
[…] Improving entity forms using embedded PowerApps […]