Add new RITM to existing REQ and update the new RITM Variables via a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2020 02:46 PM
I am trying to script a whay to add new RITMs to an existing request, but it does not seem to be working. I got it to add a new RITM to the request, but the new RITM has the default variable values in it, and not the new ones.
my 4 variable in the RITM are:
request_type
hostname
alias
network_tier
My code is:
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2020 11:03 AM
I tried it both ways - grReqItem.addNullQuery('parent') and grReqItem.addQuery('parent',''). Either way comes up with 174 on this request, even though there are now 213 RITMs in the request.
Using either code on new requests, or ever a couple requests I have with less than 10 RITMs, it works. Seems to only be failing on the request with the high number of RITMs. We are going to test this out and see if we hit a limit (possibly 174??).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2020 11:23 AM
1. Try once with the below queries only and check the row count. Remove the parent filter completely.
grReqItem.addQuery('request', Req_SysID);
grReqItem.addQuery('cat_item', CN);
2. Have you tried on any other request having ritm count greater than 175?
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2020 01:49 PM
1 - Removing the parent filter completely gave us an accurate count of the RITMs on each request we ran it on, creating a new RITM as the code says. HOWEVER, it failed to add the variable values on all the new RITMs. Looks like we need the parent line for the variable add to work? Leaving the parent line in, the RITM count is not accurate for most of the requests we tested it on.
2 - We upped the count on other requests and it works. We even got one up to 252 RITMs, and it was adding more and changing the variables. I went back to the original request, and it is still not working on this request. We are thinking that with all our testing on that original request that something else is wrong with the request and not this code, as the code is working on other requests and new requests.
I think we got it working now. Thanks for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2020 01:48 PM
1 - Removing the parent filter completely gave us an accurate count of the RITMs on each request we ran it on, creating a new RITM as the code says. HOWEVER, it failed to add the variable values on all the new RITMs. Looks like we need the parent line for the variable add to work? Leaving the parent line in, the RITM count is not accurate for most of the requests we tested it on.
2 - We upped the count on other requests and it works. We even got one up to 252 RITMs, and it was adding more and changing the variables. I went back to the original request, and it is still not working on this request. We are thinking that with all our testing on that original request that something else is wrong with the request and not this code, as the code is working on other requests and new requests.
I think we got it working now. Thanks for your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2020 02:11 PM
Yeah, seems like something has broken on the existing requests/ritms. Maybe the state they are in not allowing variables to get updated.
If you think the script is working then please mark the response as correct and helpful and close the thread. So that others can be benefited by this in the future.
Have a nice one 🙂
Thanks & Regards,
Sharjeel
Muhammad