- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 12:17 AM
Hi,
I have an onLoad client script that displays the parent incident if we open a child. I am getting sys_id instead of the actual value. Please guide.
This is the script:
function onLoad() {
if(g_form.parent_incident != '')
{ alert("This is hte parent of " +g_form.getValue('parent_incident')); }}
Someone has taught me using GlideRecord is not a suggested practice in Clinet Scripts. How to populate actual value instead of sys_id?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 12:42 AM
Yes, it is not a best practice to use glide record on client script, so you can get the value by using client script it self..
Try the below On Load Client script.
function onLoad() {
var usr = g_form.getReference('giveparentfieldname',callBack);
}
function callBack(usr){
alert(usr.number);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 12:45 AM
Hi,
what's your requirement?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 01:33 AM
Hi Murphy,
Parent incident may be viewed by putting "Parent Incident" field on the form.
- Open any Incident form or a New Incident
- Select Form Design
- Drag & drop "Parent Incident" on to a form
- Save the form
- Parent Incident can now be displayed by clicking on the magnifying glass next to the Parent Incident field.