Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to confirm all Tasks associated with a new Request/RequestItem have been created

BJM
Kilo Explorer

I am using the ServiceNow api to trigger a service catalog item that generates a ServiceNow Request. I then immediately add several comments and work notes to the ServiceNow Tasks that are created for the Request.  So essentially ServiceNow creates the Request, RequestItem, and several Tasks when the service catalog item is triggered.  Once I have the request number, I query the sc_task table.  What I am noticing is that sometimes the results of the sc_task query to find the Tasks is not complete, as in the sc_task query occurs before ServiceNow has created the Tasks.  If there was only a single task, no big deal, I could delay the query until 1 task is found. However, in my case, there could be a variable number of Tasks that may be created.  What api call can I make that will confirm that all the ServiceNow Request and associated RequestItem and Tasks have been created so I can query the sc_task table, and know that I have all the tasks?  Thanks for any help!

0 REPLIES 0