- 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-14-2016 06:10 PM
They want a red dot to show up next to the incident numbers that have parent incidents.
So, if they don't have a parent incident, is the incident field empty? If so, how about
javascript:current.incident
If it's empty, it comes back false. If it's got a value (indicating a parent) then it's true.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 07:33 PM
that didn't work - so far I have tried the following - keep in mind the field flag I am trying to check is u_parent_incident_yn on the incident table:
javascript:current.incident.u_parent_incident_yn=="true";
javascript:current.incident.u_parent_incident_yn==true;
javascript:current.incident.u_parent_incident_yn;
javascript:task.incident.u_parent_incident_yn=="true";
javascript:task.incident.u_parent_incident_yn==true;
javascript:task.incident.u_parent_incident_yn;
javascript:incident.u_parent_incident_yn=="true";
javascript:incident.u_parent_incident_yn==true;
javascript:incident.u_parent_incident_yn;
javascript:current.incident=="true";
javascript:current.incident==true;
javascript:current.incident;
How do I dot walk from Task to Incident to u_parent_incident_yn and check to see if it is true?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 07:54 PM
Ah, I see the issue. Since incident is extended from task and the field is on incident, there's not a good way to do this from the javascript line. It's a matter of database structure. You can only access task fields from the task table, not fields on the child tables.
I have an idea...
Write a script include with this function:
function hasParent(gr) {
if (gr.sys_class_name != 'incident')
return false;
if (!gr.incident)
return false;
return gr.incident.u_parent_incident;
}
Now your field style field could be:
javascript:hasParent(current);
It's totally untested, but worth a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2016 07:58 PM
great idea - I will try this tomorrow and let you know if it works - thanks for the help!!!