Restrict Import XML Context Menu on Prod Instances
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
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.
- All the conditions
- User has role of 'import_admin_xml'
- 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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello @iDNS ,
Yes, we are also using this kind of functionality, where in if users only have security admin then they will see this import xml option. What you can do, instead of using admin role shift it to the security admin role. It should work.
Please mark my answer as accepted solution and give thumbs up, if it helps you.
Regards,
Asbhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
@Abhishek_Thakur , Thanks for the suggestion.
I tried changing the property 'glide.ui.admin_import_xml_roles' to 'security_admin', cleared cache but I still see the button for Users without 'security_admin'.
Could you help me how have you implemented it, is it gs.hasRole('security_admin') in your Condition on the Context Menu or the System Property. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Change the condition in this form
sys_ui_context_menu.do?sys_id=d11613000a0a0b3e007fb501ef22352e&sysparm_view=&sysparm_domain=null&sysparm_domain_scope=null&sysparm_record_row=1&sysparm_record_rows=1&sysparm_record_list=nameSTARTSWITHimport+xml%5eORDERBYorder
as per your conditions
Please mark my answer as accepted solution and give thumbs up, if it helps you.
Regards,
Naveen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
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