- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2016 03:13 AM
Hello,
I am using script include to create incident.
I want to show the message when incident is being created.
In the below code its showing the sys_id of the incident.Can some one help on this.
gs.include("FormInfoHeader");
var fi = new FormInfoHeader();
var s = 'Thanks! Incident number ' + inc.sys_id.getDisplayValue() + ' has been created!.<br/>';
fi.addMessage(s);
Thanks
saranya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2016 03:15 AM
inc.number instead of inc.sys_id.getDisplayValue()
getDisplayValue should only be used if you are looking at a reference field and you want to return the DisplayValue instead of the sys_id of the referenced record, even if incident was a reference field in this occasion it would only be inc.getDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2016 02:30 AM
yes indeed, the href should be completely hidden and just the number displayed, i.e.:
- var url= = '<a href=' + gs.getProperty("glide.servlet.uri") + '"/nav_to.do?uri=incident.do?sys_id=' + inc + '&sysparm_view=ess" target="blank">' + inc.number + '</a>';
You may need to check the quotes are in the right place but that should be pretty much it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2016 02:50 AM
Perfect.Thanks a ton
Thanks
Saranya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2016 03:17 AM
Hello Saranya,
You can alternatively query for number from the incident table like having the sys_id
gs.include("FormInfoHeader");
var fi = new FormInfoHeader();
var gi = new GlideRecord('incident');
gi.get(inc.sys_id);
var s = 'Thanks! Incident number ' + gi.number + ' has been created!.<br/>';
fi.addMessage(s);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2016 03:22 AM
Awesome It worked.Thank you Michal and mguy
Thanks
Saranya