Querying Related Tables sc_req_item and sc_cat_item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 08:59 AM
My requirement is to pass in the "Requested Item number" and "requested item name" and check whether any records exist...
Noticed that name field is present in different table sc_cat_item... I m passing in the Requested item number and name from my client script.. This is the below code i m using...
but do we have an option to do dot walking and do this validation.. i tried it but it doesnt work... could any suggest how we can do it in simplied way?
var reqDetails = new GlideRecord('sc_req_item');
//var catItem = reqDetails.addJoinQuery('sc_cat_item');
reqDetails.addQuery('number',g_form.getValue('request_number_2'));
//catItem.addCondition('name', 'Hardware Exception Appeal');
reqDetails.query();
//create and return the array of environments
while(reqDetails.next()){
var catItemData=new GlideRecord('sc_cat_item');
catItemData.addQuery('sys_id',reqDetails.cat_item);
catItemData.query();
while(catItemData.next()){
//do the logic over here
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 09:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 09:04 AM
Can you please let me know the need of this script? I am unable to identify your aim.
Kind regards,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 09:22 AM
Hi Sourabh,
My requirement is, if the user enters in the request no(the one which he has already raised), we will be validating whether its a valid request number by querying against the requested item table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 09:29 AM
So best bet would be to use GlideAjax. As gliderecord use in client scripts not recommended.
Kind regards,
Sourabh