- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 05:52 PM
I have a field on incident called parent_incident_yn - it is a true/false field. Everyone is using My Work which is based off the Task table. They want a red dot to show up next to the incident numbers that have parent incidents. The research i have found has pointed me to Field Styles with a value using JavaScript. So I think I am dot-walking this incorrectly.
Table: Task [because that is what My Work uses]
Field name: Number [that is where they want the red dot to show up]
Value: javascript:current.incident.u_parent_incident_yn;
I have tried the following in there:
javascript:current.incident.u_parent_incident_yn=="true";
javascript:current.incident.u_parent_incident_yn==true;
javascript:task.incident.u_parent_incident_yn==true;
javascript:incident.u_parent_incident_yn==true;
Im not sure I am even in the right ballpark on this so I am deciding to ask before I spend 4 more hours trying to figure this out - I appreciate any help anyone can provide. Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 09:07 AM
OK, that's interesting. I just threw your script on my instance and it came out with the class name incident and the numbers, indicating that it retrieved the record.
My field style (BTW, you want to change background to background-color if we ever get the script working)
My script (corrected for missing parenthesis in that if statement to get the record)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 07:37 AM
that didn't work. I read that you cannot Dot Walk from a Parent Table (like Task) to a Child Table (like Incident). Not sure if that is true or not.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 07:40 AM
That's true. You cannot dot-walk from a parent table to a child table. I should have caught that. How about this revised script include to get the specific incident...
function hasParent(gr) {
if (gr.sys_class_name != 'incident')
return false;
if (!gr.incident)
return false;
var inc = new GlideRecord('incident');
if (inc.get(gr.getValue('sys_id')) {
return inc.incident.u_parent_incident;
}
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 08:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 08:25 AM
You won't need client callable checked on the script include.
Can you also throw in some debug statements in the script include and then check them in the log? We'll see how far it gets.
function hasParent(gr) {
gs.log('hasParent: Starting... gr.sys_class_name=' + gr.sys_class_name);
if (gr.sys_class_name != 'incident')
return false;
gs.log('hasParent: incident=' + gr.number);
if (!gr.incident)
return false;
var inc = new GlideRecord('incident');
if (inc.get(gr.getValue('sys_id')) {
gs.log('hasParent: got incident - parent incident y/n=' + inc.incident.u_parent_incident);
return inc.incident.u_parent_incident;
}
gs.log('hasParent: Could not read incident');
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 08:38 AM