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 01:29 PM
That is what I had in my previous comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 01:32 PM
Sourabh and Abhi,
I will try again and let u guys know.. i m doing the same way as you people have suggestion.. somehow the dot walking fails.. dont know why. but i will try further and let u know.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 01:33 PM
Is this on your personal developer instance? I can look into it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 11:42 AM
If you can tell me your entire use case and what you are trying to achieve, I will code it for you. It is very straight forward.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2016 02:30 PM
Hi Abhi and Sourabh,
I have two team development instance(Official one and not the personal one).. in one of the instance the dot walking works fine.. but in the other it doesnt any clue why its so?