How to assign System Administrator role for a user in CRM using SQL?

Recently in Dynamics 365 On-premise Dev environment, accidentally System Admin user’s Business Unit changed and hence all the security roles lost along with System Administrator role.

In that Dev environment, we don’t have any other user with System Administrator security role.

So, followed the below steps and assigned the System Administrator role to the CRM System Admin user using SQL queries.

Note: Take the backup of CRM DB before following the below steps.

Step 1: Logged in SQL with CRM System Admin role and executed the below query and got the Default business unit GUID from the BusinessUnit Table.


Step 2: Executed the below query and got the CRM System Admin User GUID from the SystemUser table.

FULLNAME LIKE ‘%CRM ADMIN%’ — CRM ADMIN is the name of my System Admin’s Full name in the CRM dev organization.

Step 3: Updated the default business unit GUID for the System Admin user by using the below SQL Query.

BUSINESSUNITID = ‘6C9A857D-D43B-E411-93F9-000D3A800C9F’ — Refer Step 1.
WHERE SYSTEMUSERID=’F2368783-D43B-E411-93F9-000D3A800C9F’ — Refer Step 2.

Step 4: Executed the below query and got the below System Administrator Security role from Role Table.


Step 5: Inserted the record in SystemUserRoles Table.

–First Parameter is SYSTEMUSERID. Refer Step 2
–Second parameter is ROLEID. Refer Step 4

Step 6: Reset IIS. Logged in CRM with System Admin User and it worked.

Hope this article helped you and share your valuable feedback on this article.


How to change BPF stages automatically using workflow in Dynamics 365

Microsoft Dynamics CRM/365 by Vishal Grade

Change BPF stages in Dynamics 365 with no code

So far we have been trying to automate BPF auto stage movement using client side js or plugin.

But again Microsoft tried to make our life easier by introducing a new feature that supports Business Process Flows as an entity in the July 2017 Update for Dynamics 365. You can now work with each Business Process Flow as its own entity through dashboards, grids, and charts. This also means that you have the ability to interact with them through Dynamics 365 workflows

In this article, I am going to focus on how you can create a Workflow for the Business Process Flow entity record to change the Active Stage when a field on the Opportunity entity record is updated. Earlier this was only possible using client-side APIs or use of a plugin.

Scenario: We have a standard lead to opportunity BPF…

View original post 300 more words

Why the plugins implement IPlugin interface and Workflows (custom) inherits the Code Activity abstract class

Microsoft Dynamics CRM/365 by Vishal Grade

Someone asked me this question which is frequently asked in interviews i.e. why plugins implemented iplugin i.e. an interface and custom workflow inherit codeactivity i.e. an abstract class?

The purpose of question is to know why codeactivty is an abstract class and not an interface like iplugin?

So to understand the answer we fist need to understand the difference b/w interface and an abstract class:

What is an Abstract Class?

An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry…

View original post 300 more words

The new model-driven form designer (WYSISYG) in PowerApps for Model-driven apps (Dynamics 365 CE) Preview

Nishant Rana's Weblog

The new model-driven form designer (Preview) has some nice features added to it like

  • Searching for fields in the form

  • Tree View showing visual hierarchy of the controls for quick view and navigation inside the form.

The icon also makes it easy to identify the data type of the field.

  • We can also check and configure how the UI would render for different type of client application

  • Property Pane for the type of control selected which allows us to quickly update the properties unlike selecting the field and then clicking on Change Properties which will open the dialog box.

Few things that we could not found are

  • Ability to select and position fields and sections.
  • Sub Grid control are not available on the form for configuration.
  • No Header.
  • Footer is available but we cannot add fields to it.
  • No Business Rules or Form Properties dialog box.
  • No Enable Security Roles…

View original post 40 more words

How to retrieve multiple records using FetchXML in Dynamics 365 Online V 9.X using JavaScript WebAPI?

In my previous article, I have explained about How to retrieve multiple records using Odata Query in Dynamics 365 Online V 9.X using JavaScript WebAPI?

And now i will use the same example, which i used in my earlier article mentioned in the above link and retrieve multiple Account records using FetchXML query.

Continue reading