Question on SNC.RequestItem(current).closeParentRequest()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 03:20 PM
Hey everyone,
I'm wondering if the SNC class functions only work on OOTB Business Rules? Reason why I'm asking is I'm trying to mimic the OOTB BR "Close Parent if Required" by making a copy and modifying it to look at "state". See screenshot below
However my BR is not doing what the OOTB does when the condition hits.
Can anyone shed some light on the reason why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2023 12:52 PM
Hi,
I made a copy of that BR and using your conditions, and it did run. I added:
new SNC.RequestItem(current).closeParentRequest();
gs.info("Close Parent if Required (copy) - new conditions ran.");
And got in Scripts log Statements:
I have no idea what that class/method does, I can't find any documentation on it. I didn't test with a sc_req_item that had a parent to see. But the BR copy does run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 09:31 AM
Thank you Bert. Yes the BR runs ok for sure. (I had verified before I posted this question.)
Regarding the SNC class, there are other postings in the Community. Basically it's something that is only available to ServiceNow.
I've also played around it a bit. It appears this function only reacts to "Stage", not "State".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 02:32 PM
Hi Bill,
I wont use un-documented classes or methods. It is simple to add logic to 'close a parent' record. But I don't know Service Catalog feature and I'll let OOB workflows manage the data. Workflows can be created, and I suspect many existing OOB workflows can be modified if desired. anyway, I suspect what you want can be done using documented API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 12:27 PM
Did you find a solution to this? I am working on the same thing (closing the parent request when ritm state closes). I have a BR working BUT I realized that it does not factor in if a request has multiple ritms. So I am trying to find a good way to check that the ritm that is closed out is the last one of the request.