I followed the exact steps in this link but the Reactivate button still showing on the Case Form.
Even I added an Alert line in the JS functon but does not seem to be detected.
Not sure what exactly missing?
How to Hide Buttons Based on User Security Role in Dynamics 365 Sales | Stoneridge Software
I beleive I found the issue.
I was missing the step of attaching the new rule to the command.
Thank you,
Thank you Steve, but is not it the same code in the link above. this is exactly what I'm using and is not working.
I'm guessing this is not a code issue. it is something else can e related with the solution.
Hi Alaa Ramadan,
Please change code to this to have a try:
// // Hide the Activate button and the Deactivate button when user has Salesperson security role // function hideActivateAndDeactivateRibbonButtons() { // // default return value to true. Show buttons // var value = true; // // Set variable with SalesPerson security role GUID // var constSalesPersonGuid = "74E3A3A3-E6F3-4B97-A045-A557B1660293"; // // Get the Current User's Security Roles // // D365 v9 var userRoles = Xrm.Utility.getGlobalContext().userSettings.securityRoles; // // loop through roles and look for SalesPerson guid // for (var i = 0; i < userRoles.length; i ) { if (userRoles[i].toUpperCase() == constSalesPersonGuid.toUpperCase()) { // // Hide Activate button and the Deactivate button // value = false; break; } } return value; }
And please make sure the enable rule is tied to the command.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156