- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 04:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 06:53 AM
I'm not certain why we are calling the script include and querying the dictionary at all as we already know the tables because they are being used to generate the query. If the intent is that I don't know what table my id is for so I want it to try multiple tables then you can do something like the following untested script:
var tables = ['kb_category','kb_knowledge_base'];
var id = "25cd15c3ac6c728056e1781325626541";
for (var i = 0; i < tables.length; i++) {
var gr = new GlideRecord(tables[i]);
if (gr.get(id)) {
target.parent_table = tables[i];
target.parent_id = id;
break;
}
}
But if you know the table, it should be as simple as:
target.parent_table = "kb_knowledge_base";
target.parent_id = "25cd15c3ac6c728056e1781325626541";
In either case, I would remove the field mapping entries in favor of the on before script to guarantee ordering.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 05:11 AM
Can you show me what you have in your map?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 05:14 AM
My source script is,
answer = (function transformEntry(source) {
return "25cd15c3ac6c728056e1781325626541"; //return IT Knowledge Base sys_id.
})(source);
and
traget field is parent_id

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 05:19 AM
Ok, since it looks like that ID is coming from the Knowledge bases table, make sure you have another field mapping that maps to the dependent table field (parent_table, I think you said):
answer = (function transformEntry(source) {
return "kb_knowledge_base";
})(source);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 05:13 AM
I should also ask if you are mapping the table name into the dependent table field. Both fields need to be set for the Document ID field to render properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 05:36 AM