How to re-initiate calling the rest message from flow/sub flow whenever error/400 status received?

KM SN
Tera Expert

On 10th action in below sub flow I am calling the rest message there is a possibility that I may receive  400 saying request is not created from third party or general error.

 

If I got the 400 or error, I should not move to next step instead it should wait for fixing the issue caused due to 400 or error and then should re-initiate the same 10th action once after successful status code i.e. 200 I need to move to next logic inside the flow.

What are the different ways I can implement here following best practices in ServiceNow?

flow-7.png

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @KM SN 

I'm not 100% sure, but you might be able to capture this error in the error handler and then define it to go to the next step. Again, I'm not entirely certain, so please check this.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@KM SN 

you can use retry mechanism in flow

Flow and Action Error Handling Level 1: Retry and Action Error Evaluation - Workflow Automation CoE 

https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/administer/flow-designer/concept/r...

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

KM SN
Tera Expert

As I am not using the REST step for initiating the outbound call instead manually, I written a script inside the action so I might not leverage the options available on the shared article by you.

Is there any another way so that I can retry using the error handler or through script step itself?

By the way out of curiosity I am asking this how can I use Authentications or OAuth profile If I want to use REST step in action? Because all I am seeing is just connections not anymore? am I missing anything here?

@KM SN 

you need to have custom logic for this

you can have max 3 retry count and loop it and wait for 2-3mins for every loop

example: start with count as 1 and hit the API, check the response if it fails wait for 2-3mins and then again run the loop, increment the count as 2 and do same

stop the loop when count reaches 3

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader