Skip to main content

Part 2 - Automatic CE User creation, removing/assigning Dynamics License Process from Power Virtual Agent embedded in PowerApps Portal using Power Automate and Microsoft Graph API

# Part 2 - Dynamics CRM D365 (CE) Configuration

1.      Create a text field on contact from in CRM and label it as Azure Object ID
-        This field will be holding the Object Id of the AD User
2.      Create a lookup field on contact form in CRM and label it as User Resource
-        This field will be holding the Guest User created by the automation process illustrated in this blog.
3.      Create an OptionSet field on Contact form in CRM and label it as Affirm Resourcing
-        This will have two Options Allowed and Not Allowed.
o   When Allowed, it will create a AD User and add it to the group created in #Part 1 and it will assign CE license and will add it to a Team with pre-defined security roles. A bookable resource will also be created and will enable it for Field Service mobile app.
o   When Not-Allowed, it will remove the user from the AD group and thus revoking the license and inactivate the bookable resource.
4.      Create a wholenumber field on contact from in CRM and label it as Number of Work Orders Assigned
-        This field will be storing the Number of WO currently Open or being worked on by the Resource.
-        The purpose of this field Is also to ensure that licenses are not removed from the resource while working on a particular WO.
5.      Create a text field on contact form in CRM and label it as Verification Code.
-        This will store the verification code sent in the email by Power Virtual Agent.
6.      Create an OptionSet field on Contact form in CRM and label it as Current Resource Agent Status
-        This will have four options.
o   On-boarding In Process, this option is set once the CE Contact is created in Azure AD and added to the AD group.
o   On-boarding Completed, this option is set once the Licenses are applied to the Azure AD User.
o   Off-boarding In Process, this option is set once the User Resource for the CE Contact is removed from the Azure AD Group.
o   Off-boarding Completed, this option is set once the Licenses are removed from the Azure AD user.
-        Note: In my experience it takes 3 to 4 minutes to apply licenses, after user is added to AD group. And it takes 3 to 5 minutes to remove the license, after user is removed from the group.
7.      Create a global OptionSet with following Options
-        This can have options related to the services provided by the account.
-        Note: For this demo purpose I have added three options
o   Electrician
o   Cleaning
o   Plumbing
-        For the demo, I have used only the Electrician for all the Power Automate and Power Virtual Agent related work.
The design could be better, but this is what I have used to balance work-life lol. Also, there are some hardcoded guids that I have used in the Power Automate for the retrieval and creation of records. But this gives us the idea of implementing PowerApps Portals, Power Virtual Agent, Power Automate, Azure, Microsoft Graph API altogether.

The screenshots for the account and contact CRM form is shown below.



Comments

Popular posts from this blog

Select Multiple Records from Entity List

Select Multiple Records from Entity List and Perform CRUD on records or related records Here I am going to demonstrate the process that can be used to select multiple records in an entity list to perform CRUD on records or related records. In this, we have one entity list which displays all the courses that are open for enrolment. CRM Contacts can log in to the portal and enrol for the desired coursed. The entity list is rendered on the portals as follows: The submit button is custom submit button which is designed to call Web API in order to perform the CRUD operation. Checkbox against each entity list item is designed using JQuery Registration Status is the Response from Web API Open means that the Registration is Currently Open for the logged-in portal contact to enrol and they can select multiple checkboxes and then click on Submit button to create their registration, In this, I am going to select : 1.  Diploma in Web Development 2.Bachelor of Applied Inf

Editable Entity List or Editable Subgrid PowerApps Portals

Editable Grid PowerApps Portal In this blog, I am going to explain how we can use PowerAutomate and old school JQuery on PowerApps portal to convert Entity List into editable entity list or subgrid. I am only using the string attributes of the Lead entity for Quick Update in this blog. The benefit of making entity list editable with this approach is that we do not loose the OOTB functionality of Search, Sorting, Grid Configuration to enable edit/view-details/delete and Filtering. How I manipulate the data attributes in entity list using JQuery is shown in the below screenshot The screenshot below shows how the code manipulates the entity list html elements using the above code. The PowerAutomate for updating the data in CRM. A success message is displayed on the portal to let user know that the update has been accomplished and the record is Updated in CRM The value retrieval on Click of custom Quick Update bu

PowerApps Portal Generic Error Feedback from Portal User

As we all know that whenever there is a server error on the PowerApps Portals we only see a generic error message. Which looks like There is a method of logging errors from the portal using Azure blob Storage, but this is something that I won’t be discussing today. I will be going ahead and asking for more information for the error on the portal from the Portal User actually experiencing it. Let’s see how we can achieve this thing. We can create Portal Generic Error in Content snippet to add custom text or information for the error message, but it is hard to get entity forms added using Content Snippet or any other HTML to be created using any bootstrap or custom css on this page. The only CSS that you get on this page is from the index page which highlights the h1 tag with bold and red color and everything that you add goes into the div with class dialog. I have made use of JavaScript to change HTML content and have added an entity form asking Portal User to submi