Announcements
No record found.
Hi,
To conditionally show or hide the Edit button in a model-driven app based on user roles and field values, you’ll need to use Ribbon Workbench along with JavaScript. Here's a general approach to get started:
Use Ribbon Workbench: This tool allows you to customize command bar buttons. You can define display rules and enable rules based on JavaScript functions.
Create a JavaScript Web Resource: Write a function that checks:
status
Example snippet:
function shouldShowEditButton(formContext) { var status = formContext.getAttribute("status").getValue(); var userRoles = Xrm.Utility.getGlobalContext().userSettings.roles; var hasRole = userRoles.some(function(role) { return role.name === "YourRoleName"; }); return !(hasRole && status === "Complete"); }
Attach the Function in Ribbon Workbench: Use this function in a Display Rule or Enable Rule for the Edit button.
Publish and Test: After publishing the changes, test the behavior in your app to ensure the button visibility aligns with your criteria.
This setup gives you flexibility and control over UI behavior based on business logic.
Please verify if this helps you move forward.
Thanks and best regards,\ Daniele\ Note: This response was prepared with support from Copilot to ensure clarity and completeness.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
ManoVerse 196 Super User 2026 Season 1
11manish 129
CU11031447-0 100