The user with SystemUserId in OrganizationContext is not licensed

Today while creating Account record, I got the below error.

The user with SystemUserId = “” in OrganizationContext = “” is not licensed, and its SystemUserAccessMode=0 is not either of (NonInteractive=4, SetupUser=1)

I did the below steps to resolve this issue

  1. I checked the “AccessMode” of the logged in user but it sets to “ReadWrite” mode which is OK.
  2. I compared the Guid of the logged in user and SystemUserId from the error message, both are not same, so decided that there is no problem with logged in user.
  3. Finally, I did check the processes and I found there is one process which is running on create of Account owned by an disabled user.

I assigned this particular process to another service user which resolves this issue.

Hope this helps.

Business Unit Hierarchy – My First XrmToolBox Plugin

I am very happy to announce that my first plugin “Business Unit Hierarchy” is listed in XrmToolBox now.

Thanks to Nishant Rana for giving me an idea to develop this.

This plugin is simple but very useful. Most of the times we navigate to so many windows to understand the BU hierarchy in our organization (I faced this situation many times) but with this plugin it is very easy to get the complete overview of BU Hierarchy. I plotted the BU Hierarchy in tree view presentation which is easy to understand for any user.

Here are list of steps to use this plugin

  1. Install “Business Unit Hierarchy” plugin from XrmToolBox Plugins Store.
  2. Connect to your organization.
  3. Open the plugin and click on “Load Business Unit Hierarchy” button.

That’s it, Business Units of your organization will be loaded in a hierarchical structure like in the above screenshot. The BU’s that are loaded in red color are disabled ones. Select any BU to see all the Users and Teams under this.

Hope it helps to everyone and saves time to understand the BU Hierarchy.

Please leave your feedback and rating on this plugin in the below link https://www.xrmtoolbox.com/plugins/XrmTools.BusinessUnitHierarchy

All about XRM.Tools

Today while exploring new stuff, I found very interesting tool for developers which is called XRM.Tools. I would like to share this with all of you. It provides a set of tools which gives you overall picture on particular things like Security Roles, Business Rules, Server Trigger and etc. The main advantage with this tool is, no need to download or install unlike XRM ToolBox (everything in cloud)

Available Tools under XRM.Tools

  1. Business Rule Explorer
  2. Security Role Explorer
  3. Server Trigger Explorer
  4. Access Token Generator
  5. Web API Builder
  6. Auto Number Creator
  7. Record Counts
  8. Azure Region Check

I would recommend everyone to go through this link where David Yack explained everything about how to use this tool.

Note: As a developer, you have a chance to build and contribute a new tool.

Integration between SharePoint and Exchange Online

Recently I worked on one project where I integrated the contacts and groups from SharePoint to Exchange Online. I want to share the approach that I followed to do this.

I used PowerShell scripts to create objects (Contacts and Groups) in Exchange Online. Initially, I thought of using Azure Functions with C#, but it’s not possible as there is no API exposed for Exchange Online. I used MS Flow to trigger my PowerShell scripts that I have developed in Runbooks (Azure Automation) on Create/Update of sharepoint list item. We have an action in Flow to create a job of a particular Runbook (Azure Automation –> Create job).

The reason to use MS Flow for this requirement is to develop an application with low-code which facilitates the customer to perform some basic changes without need of a developer.

Architectural Diagram

Flow Design

Happy to hear the feedback on my approach.

PowerApp Screen – OnVisible Event Not Firing

While working on one PowerApp, I observed that the code written in first screen “OnVisible” event is not executing which means OnVisible event is not firing. I found couple of workarounds for this issue.

Workaround 1: Add a welcome screen with a simple button which will navigate to your actual screen.

Workaround 2: If you don’t like the Idea of having a welcome screen, you can use this one. Place a timer control on the screen (make it invisible and sent to back) and write the code in “OnTimerEnd” event.

Properties for Timer Control

OnTimeEnd event

Hope it helps to solve this issue.

How to use Virtual Agent (bot)

Recently for one of our customer I developed a Virtual Agent (bot) which will ask basic details like First Name, Last Name, Company Name and Email Id for the Portal Registration and at the end it will save the data in CDS. Follow the below steps to develop a simple bot

Step 1: Create a new trail instance here (as of now Virtual Agent preview is only available for United States region)

Step 2: After the trail instance is created, create an Entity to save the portal registrations data. In my example, I created an entity called “Portal Registration” with the below fields

  1. Last Name
  2. First Name
  3. Company Name
  4. Email Id

Step 3: Create a MS Flow. We will integrate this flow with bot in the next steps to save the data in “Portal Registration” entity. Please note, you have to create a Flow in “Common Data Services Default Solution”, otherwise bot can’t access this Flow.

The trigger for the Flow should be “When a HTTP request is received”.

The Request Body in this example should be like below.

{
“type”: “object”,
“properties”: {
“lastname”: {
“type”: “string”
},
“firstname”: {
“type”: “string”
},
“companyname”: {
“type”: “string”
},
“email”: {
“type”: “string”
}
}
}

Step 4: Go to your Virtual Agent Preview instance (https://va.ai.dynamics.com) and create a bot. Use “Bots panel” button

on the top right navigation to create a new bot. Provide bot’s name and click on Create.

Step 5: After bot is created, you can add your own custom Topics. You will have some predefined Topics available once the bot is created which you can use for your reference.

In my case, I created “Portal Registration” Topic. You have to specify some Trigger phrases to trigger a particular topic. In this example, when ever you enter any of the phrase that I specified in the below screenshot, the bot will choose my topic and start the conversation which we will setup in next steps.

Step 6: Once you click on Edit button, it will redirect to actual page where you should develop your conversation. Use “Bot Says” action to ask a question to the user and “User Responses” action to get the answer from the user, finally capture the user response in a parameter for further use. Repeat this for rest of the questions (First Name, Company Name and Email Id)

Step 7: At the end, we have to save this information in CDS. For this requirement we have to integrate a MS Flow with the bot. Use “Action” action and select the Flow that we created in Step 3 and pass the parameters to MS Flow

Step 8: At the end Deploy the bot on Demo Website and Publish it. Use the bot through URL which is generated after Publish.

Hope it will give you basic idea on how to use bot with MS Flow.

How to remove unwanted PowerApp parameters in MS Flow

Recently I worked on one PowerApp which will call the MS Flow to perform my action. Initially, I created a Flow with 8 parameters and passing the values from PowerApp but at the end I realized that I can perform my action with 6 parameters in MS Flow, so decided to delete the extra 2 parameters as my PowerApp is expecting the value for those parameters which are not required. There is no direct approach to delete the parameters in Flow, I think Microsoft still working on this issue but there is workaround to do this

Workaround:

  1. Delete the PowerApp trigger on the top of the MS Flow and you see a message box “This step and associated dynamic content will be deleted from this flow.”
  2. Click on OK (It won’t affect the actions in your flow)
  3. Add the PowerApp trigger again, this should give you a chance to provide a new dynamic content.

I know it’s not a best approach but as of now we don’t have any better way to resolve this issue. Hope it helps….