- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 03:05 AM
Hi,
On the incident form we have two reference icons next to the caller_id field: "Add new user" and "Change user".
Those icons are not visible on the self service incident form. This is all Eureka
I have upgraded one of the non-production instances to Helsinki, and all of a sudden, those icons are visible on the self service form.
Is there a way to hide those icons only on the self service form?
I have tried a on load client script where I entered the "ess" view name, after unchecking the global checkbox.
In the script section I added this code:
function onLoad() {
//Type appropriate comment here, and begin script below
$('add_new_user.incident.caller_id').hide();
$('change_user.incident.caller_id').hide();
}
The icons still appear on the self service form.
Maybe the UI macro's need to be changed, but I don't know how to do this.
Kind regards,
Paul
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 03:41 AM
you may even be able to do this even cleaner by checking the view
<g:evaluate>
var currentView = RP.getParameterValue('sysparm_view');
</g:evaluate>
then just running if view is not ESS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 03:22 AM
Hi Paul,
Check your dictionary attributes. I suspect these are added via reference field decorations.
See section 4: Reference Fields - ServiceNow Wiki
FWIW, Doing this via client script is always risky when it comes to upgrades. We've warned about this for years. It's documented in the Client Script Best Practices - ServiceNow Wiki .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 03:37 AM
Hi Chuck,
Yes, the icons are added through attributes in the dictionary. It is not that I want to get rid of them. I just don't want to show them on the
self service incident form, but I do want to show them on the itil incident form.
Regards,
Paul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 03:39 AM
Would making the field read-only for the ESS users be an option Paul?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2016 03:35 AM
you can add a check to the ui macro itself, it's a little trickier but something like this should work, I built this one for an assign to me button to appear next to assigned to so change as appropriate
there's a lot of other examples in other ui macros that check if users have roles or other conditions in out of the box instances, they all have slightly different approaches but general idea is the same, run a script to check then use code to evaluate the answer as to whether you show it or not.
(if you do a search on ui macros where XML contains role you can see them all).
snippets from my one which will be useful.
<g2:evaluate var="jvar_show_assign_to_me" jelly="true">
var id = __ref__.getSysIdValue();
if (id != null) {
"none";
} else {
"";
}
</g2:evaluate>
<a id="${jvar_n}"
onclick="assignToMeOnClick('${ref}')"
name="${jvar_n}"
style="display:$[jvar_show_assign_to_me]"
title="${gs.getMessage('Assign this task to me')}">
<img border="0" src="images/account.gifx" />
</a>
<script>
function onLoad_show_assign_to_me() {
if(!g_user.hasRoles()){
$('${jvar_n}').hide();
} else {
$('${jvar_n}').show();
}
}
more scripts here but I won't include them as you don't need them
</script>