Question on SNC.RequestItem(current).closeParentRequest()

Bill Ye Zhang
Tera Contributor

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

 

1.png

However my BR is not doing what the OOTB does when the condition hits.

 

Can anyone shed some light on the reason why? 

6 REPLIES 6

Bert_c1
Kilo Patron

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:

Screenshot 2023-05-27 154951.png

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.

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".

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.

Erik Stuer
Tera Guru

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.