Hide and Show custom button based on the security role and field value

Custom buttons in Dynamics 365 CRM can be shown or hidden based on security roles and field values To show or hide a custom button based on security roles: Create a JavaScript function that checks both the user's security roles and field values Combining Security Role and Field Value Checks - JavaScript example // Chain request function ChainrequestFormCustomization ( primaryControl ) { "use strict" ; debugger ; var globalFormContext = primaryControl ; var chainType = globalFormContext . getAttribute ( "emt_chaintype" ). getValue (); var currentUserRoles = Xrm . Utility . getGlobalContext (). userSettings . securityRoles ; var chainManagerRoleId = "0e3ebb51-35ec-e911-a812-000d3a33febe" ; // Chain manager var lamChainManagerRoleId = "38ee7b56-e2ed-ef11-be21-0...