zoukankan      html  css  js  c++  java
  • Display different Business Process Flow based on user security role in D365 CE /PowerApps

     

     

    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. 

    Implementation:

    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;
                    return;
                }
            });
    
            if (userHasRole === true) {
                formContext.data.process.setActiveProcess("b7363263-2265-eb11-a812-000d3a3759c1"); //Pass the GUID of BPF to show when user has security role
            }
            else {
                formContext.data.process.setActiveProcess("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:

    Testing:

    User with Manger Role:

    User without Manager Role:

    Note:

    1. Make sure you have added both the Business Process Flow in the Model-driven app.

  • 相关阅读:
    游戏修改器编写原理
    欲练 CSS ,必先宫 IE
    HTML结构化:CSS布局入门指南
    用css来定义table的样式
    HTML表格无空隙嵌套方法
    CSS布局学习笔记
    绽放最后的一丝美丽
    这种感觉真爽
    诗人,是否还有生存的空间
    提升人气的秘密武器
  • 原文地址:https://www.cnblogs.com/lingdanglfw/p/15068762.html
Copyright © 2011-2022 走看看