Saturday, 28 January 2023

How to get logged in User's Security Roles using Java Script in dynamic CRM 365.

 function GetloggedUser () {

    var roles = Xrm.Utility.getGlobalContext().userSettings.roles; 

    if (roles === null) return false; 

    var hasRole = false;

    roles.forEach(function (item) {

        if (item.name.toLowerCase() === "manager" || item.name.toLowerCase() === " System administrator") {

            hasRole = true;

        }

    }); 

    return hasRole;

}

No comments:

Post a Comment

How to get logged in User's Security Roles using Java Script in dynamic CRM 365.

 function GetloggedUser () {     var roles = Xrm.Utility.getGlobalContext().userSettings.roles;      if (roles === null) return false;      ...