Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Restrict Import XML Context Menu on Prod Instances

iDNS
Tera Expert

Hi,

 

I have been trying to restrict the visibility of 'Import XML' Context button on Prod Instances, I have tried to modify the condition on the Context Menu to below but the button seems to be visible to all 'admin' Users. 

 

I have tried to break it down for all 3 scenarios, neither of them seem to work.

  1. All the conditions
  2. User has role of 'import_admin_xml'
  3. Instance is 'xxxxxdev'

I have further tried to update the System Property 'glide.ui.admin_import_xml_roles' value from 'admin' to 'import_admin_xml'. without any luck. 

 

Has anyone implemented this before or have any advice on how I could achieve it? Thanks in advance!!!

 

//Initial Condition
(gs.hasRightsTo("ui/context_menu.import_xml/read", null) && !ListProperties.isRelatedList() && !ListProperties.isRefList() &&!ListProperties.isRemoteTable() && (gs.hasRole('import_admin_xml'))) || (gs.getProperty('instance_name') == 'xxxxxxxdev')

//Role Condition Only
gs.hasRole("import_admin_xml")

//Instance Condition Only
gs.getProperty('instance_name') == 'xxxxxxxdev'

 

5 REPLIES 5

Bhuvan
Giga Patron

@iDNS 

 

Check if you can use property glide.ui.security.upload.roles to limit the roles that can import XML files. You can create a new role and only if that role is assigned to user, they can import XML using the property.

 

Refer below thread for reference

 

https://www.servicenow.com/community/developer-forum/issue-with-import-xml/m-p/2153277

 

If this helped to answer your query, please mark it helpful & accept the solution. 

 

Thanks,

Bhuvan