Allow non-admin users to use the Show XML context menu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 08:49 AM
I'm trying to allow a role called 'integrator' to have access to the 'Show XML' context menu. I've copied the 'Show XML' context menu rule and set the condition to (gs.hasRole('integrator')); but it still isn't showing up in the dropdown when one of the users right clicks on the header. Can anyone help me find what I'm missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2017 09:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-02-2017 12:57 PM
Thanks, Lars.
It looks like you are correct. Do you happen to know where I can find some documentation around the scripting in this macro? I'm trying to figure out how to interpret the below line and see how either I could give the user read access to context_menu.show_xml or add another condition to the macro to view this.
<g2:evaluate var="jvar_context_menu_show_xml" expression="gs.hasRightsTo('ui/context_menu.show_xml/read', null)" />
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2017 12:15 AM
Im pretty sure you won't find any documentation on this.
But is easy to make your own. Just add the following lines under the existing section in line 151-153
<j2:if test="$[gs.hasRole('integrator')]" >
gcm.addHref("${gs.getMessage('Show XML')}", "xmlView('${ref}', '$[${ref}.sys_id]');");
</j2:if>
You must be aware though, that you will "own" this object and will not receive updates for it.
Instead just create your own UI Action to generate the URL that the XML viewer popup uses:
table_name.do?sys_id=[sys_id]&sys_target=&XML=&sysparm_domain_restore=false&sysparm_stack=no
Use this script in a client side ui action:
function showXML() {
window.open (g_form.getTableName() + ".do/?sys_id=" + g_form.getUniqueValue() + "&sys_target=&XML", "mywindow","location=1,status=1,scrollbars=1, width=1000,height=500");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2017 12:28 AM
I think you can also request read-only account access via HI.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022