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