- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 08:43 AM
Hi Expert,
Thanks in advance and sorry for my english.
My question is while writing the script on ,sc_catalog, sc_category, sc_cat_item ,sc_request, sc
_req_item, sc_task table how to apply add query .
how to match the query between to table.
For EG:
var grItem = new GlideRecord('sc_req_item');
grItem.addQuery('sys_id',current.parent);
or
var gr = new GlideRecord('sc_cat_item');
gr.addQuery('sys_id', current.sys_id);
in this script grItem.addQuery('sys_id',current.parent); and gr.addQuery('sys_id', current.sys_id);
I dont understand how to apply this
Please explain me , I will really appreciate .
Solved! Go to Solution.
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 09:33 AM
Hi,
So sys_id the unique/primary key for any record.
Lets take an example:-
,sc_request _> sc_req_item -> sc_task table
sc_request is the parent of sc_req_item and sc_req_item is the parent of sc-task
Now if you want to search for a records in sc_task which has the same sc_req_item, you would use the below:-
var gr = new GlideRecord('sc_task');
gr.addQuery('sys_id', current.request_item);
Above sys_id is the primary key while request_item is the field which store the RITM on the Catalog task table as RITM is parent of sc_task
gr.addQuery('sys_id', current.request_item); This is generally used when two tables have any sort of connect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2022 03:42 AM
Sure. Say for example let us take Incident and Incident task as Two form shown below:
Incident Record:
Incident task:
So look at above screenshot, in Incident task you will see Incident field highlighted in Red which is holding the value of Incident record, so this way you can identify on child record by going to child table and see which field is referring back to Parent table.
In this case it is Incident. There can be possibility that the field which is referring to Parent record is not added to form layout of child table form , so this does not mean that it will not exist.
Navigate to the Dictionary module and give filter as Table contains Child Table Name and then check if there are any reference field which referrs back to parent table or not. Look at screenshot below:
So these are ways to identify. Let me know if you are stuck.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2022 08:13 AM
Thank you so much shloke, for valuable time and effort.
Hope this helps. Please mark the answer as correct/helpful based on impact.