- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 05:59 AM
I have a order guide in which when a request is raised it will create 2 RITMs ( 2 different catalog items ) my requirement is
test A catalog item ritm should be finish until then test 2 catalog item RITM should be on pause , the one way i am thinking of doing it is to put a wait condition on test 2 workflow and check if the request have test 1 catalog item then wait until its finish , and the code follows as below , there is some issue with code can some one help me with this code
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.request);
gr.addQuery('cat_item', "99fb579bdbbb73401e49f9051d96191f");
gr.addQuery('state',"3");
gr.query();
gs.log(" For RITM " +current.number +" the ROW Count is " +gr.getRowCount() );
if(gr.getRowCount() == '1'){
answer = true;
}
and also please suggest me if you have any other scalable solution
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 11:40 AM
I found this article this might be helpful
https://www.servicenowguru.com/system-definition/order-request-items-order-guide/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 06:02 AM
Change:
gr.addQuery('state',"3");
to
gr.addQuery('state', 3);
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 06:29 AM
Thanks allen ,,update the state , still same issue workflow is stuck in test 2 ,, is my script logic correct ?
checking for Request and checking for catalog item test 1 and state is closed complete .
RITM 1 is closed complete
Test 2 is still waiting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 07:41 AM
Wait for conditions are only checked/updated when the current record is updated. Your script is fine but it's not running the check in the wait for condition because nothing has changed on the current record. You can either add something in to the workflow on the first ritm to update the state or something on your second ritm or write something in to the master request wf.
I had this issue recently but i had a whole series of ritm's that needed to be triggered at different times so i built a custom request workflow, triggered it by creating one ritm with a scripted order guide and then created the rest when i needed them via script. This might be a bit complex for your requirements if you only have 2 ritm's but worth considering if you have more going on than you've written here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2019 08:42 AM
Thanks David , this is just a draft but we have multiple catalog items , i will try your solution