Hi, we have a requirement to Show Documents Subgrid only to Customer Service and Hide for everyone else.
I am using the below code for both purposes. But it hides the Subgrid for CSR as well.
Below is the WebResource and Calling both the functions onLoad Page.
// Show SP Grid and Load Payment Tab for CS var leadFormCustomization = { customEditAccess: function (execContext) { debugger; var formContext = execContext.getFormContext(); var userSettings = Xrm.Utility.getGlobalContext().userSettings; //Get Security Roles of the current User var securityRoles = userSettings.securityRoles; //Below is the GUID of the Security Role "CustomEditAccess" var securityRoleId = "7AD8BA9C-7A04-E911-810D-0050569D9B94"; // CSR Manager for (i = 0; i < securityRoles.length; i ) { //If current User contains the Required Security Role if (securityRoles[i].toUpperCase() == securityRoleId.toUpperCase()) { formContext.getControl('Sharepoint_grid').setVisible(true); //Show Subgrid formContext.ui.tabs.get("tab_2").setFocus(); //Load Tab }}}} // Show Hide SharePoint Grid to Upload Documents function ShowhideSubgrid2(executionContext) { var formContext = executionContext.getFormContext(); // get the form Context var uploadContract = formContext.getAttribute("rnu_uploadcontract_payment").getValue(); // get the option set value Yes if(uploadContract == 1) { formContext.getControl('Sharepoint_grid').setVisible(true); //Show Subgrid } else { formContext.getControl('Sharepoint_grid').setVisible(false); //Hide Subgrid } }
How can I avoid hiding it for the CSR role???
Thank you in advance.