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 Setup SLA in CE module

Setting Up SLA (Service Level Agreements) in Dynamics 365 Customer Engagement (CE) A Service Level Agreement (SLA) in Dynamics 365 CE (Cust...