Skip to content

Display different Business Process Flow based on user security role in D365 CE

In this blog, we will look at how we can display different business process flow based on user security role in D365 CE.

Use Case:

In my example, I have two Business Process Flow on Opportunity entity.

  • Opportunity Sales Process
  • Manager Process

Users with a “Custom Project Management Role” security role can only see Manager Process Business Process Flow.


var formCustomizations = {

    displaybpf: function (executionContext) {

        var formContext = executionContext.getFormContext();
        var managerRoleId = "520359B5-FF61-EB11-A812-00224806B6E3"; //GUID of Manager Role
        var userSettings = Xrm.Utility.getGlobalContext().userSettings;
        var userRoles = userSettings.securityRoles;
        var userHasRole = false;

        userRoles.forEach(roles => {
            if (roles.toLowerCase() === managerRoleId.toLowerCase()) {
                userHasRole = true;

        if (userHasRole === true) {
  "b7363263-2265-eb11-a812-000d3a3759c1"); //Pass the GUID of BPF to show when user has security role
        else {
  "3e8ebee6-a2bc-4451-9c5f-b146b085413a"); //Pass the GUID of other BPF to show when user does not have security role
  • register an Event On Form Load, as shown below:


User with Manger Role:

User without Manager Role:


  1. Make sure you have added both the Business Process Flow in the Model-driven app.
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments