- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 03:11 AM
Hi All,
I just noticed the below code in one of the Relationships. Can you please explain "SubQuery" ?
current.addEncodedQuery("SUBQUERYsys_id,document_id,interaction_related_record^interaction=" + parent.sys_id + "^ENDSUBQUERY");
Applies to Table: Interaction
Query from Table : Task
Thanks,
Mohan
Solved! Go to Solution.
- Labels:
-
Agent Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 03:27 AM
Hi Mohan,
refer below link for help
addJoinQuery method in GlideRecord
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
10-15-2020 03:27 AM
Hi Mohan,
refer below link for help
addJoinQuery method in GlideRecord
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
11-25-2020 03:54 AM
Hi Mohan,
Adding on Ankur's reply...
If you open the sys_relationship entry (which you are referring to here), the "Queries From Table" is Task and the encoded query is "SUBQUERYsys_id,document_id,interaction_related_record^interaction=" + parent.sys_id + "^ENDSUBQUERY", meaning, it is joining the task table with the interaction_related_record table on task.sys_id = interaction_related_record.document_id... and on top of that, they are adding a filter condition (interaction_related_record.interaction= <current Interaction Object's sys_id>), just to display the ones related to the current Interaction record in the Related List.
the above encoded query gets translated to something like this...
var gr = new GlideRecord('task');
var intGr = gr.addJoinQuery('interaction_related_record', 'sys_id', 'document_id');
intGr.addCondition('interaction', <current Interaction Object's sys_id>);
gr.query();
Thanks
Thejeswar N