- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2015 05:13 PM
I have two tables. Both inherit from task. The parent table has some custom fields on them (we'll call it u_custom_field.)
I'm trying to reference this custom field from the child task, which is also a custom table. The child is using the inherited 'parent' field to link back to the parent table. I am creating these child tasks via workflow, so I'd prefer to continue using the inherited field.
Everything appears to work fine. Running a query via url similar to:
...service-now.com/u_custom_child_task.do?sysparm_query=parent.u_custom_field%3Dvalue
appears to work just fine, and returns the search results I would expect.
The problem comes in when I try to do a query. Here's a sample of the code I've tried. This is from a clientside UI Action.
var parent_custom_task = g_form.getReference('parent');
This works; I can retrieve parent_custom_task.number, or parent_custom_task.state without any problems. But if I try
parent_custom_task .u_custom_field
I get 'undefined'. All of my custom fields return this same result, whether they are choice lists (like the value I am trying to retrieve) or strings, or references. I have to assume that this is because the 'parent' reference in the child task table (inherited from task) is set to reference task and not my custom parent table with its custom values. The question is: how do I get around this?
This doesn't have to run very quickly. It's a button that users will very rarely need. But I can't seem to find a way around this issue. Does anyone have a suggestion, or an explanation for the behavior? Thanks in advance for any help you can offer.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2015 12:52 AM
I think you have identified the problem, the "parent" field references the base task not the extension table. You will need to declare a new GlideRecord "extension table" and get it using the sys_id in parent. This object should then have the custom fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2015 12:52 AM
I think you have identified the problem, the "parent" field references the base task not the extension table. You will need to declare a new GlideRecord "extension table" and get it using the sys_id in parent. This object should then have the custom fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2015 08:29 AM
That was it exactly! I knew there had to be a way around that issue. Thank you so much for your help. I don't know where I'd be without this community--probably still beating my head against this issue, I'll bet.