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 abort an action in servicenow ?

Smriti Rastogi
Kilo Guru

 

I am using REST Api - async step where I am getting a payload with these details for change request form -

1. Short Description

2. Description

3. Requester

4. Configuration Item

5. Correlation ID

I have made all these mandatory in the body

Now I see if the body is recieved empty the change is still created and flow is completed and flow execution id is sent as a response. 

Ideally , I think it should flow should run into error.

Secondly If the CI which is recieved is not found in ServiceNow or is retired we need to abort the action and send an error message back but I see in this case flow goes into error but still the flow execution id is sent as a response.

Basically how do I send an error response for above cases?

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

Hello,

Can you try this method

current.setAbortAction(true);

this will abort the current action 

Please accept the solution of it helps you

View solution in original post

9 REPLIES 9

Mohith Devatte
Tera Sage
Tera Sage

Hello,

Can you try this method

current.setAbortAction(true);

this will abort the current action 

Please accept the solution of it helps you

What does current represent here?

Kalyani Jangam1
Mega Sage

Hi, Please check below link

https://servicenowguru.com/scripting/stopping-record-submission-servicenow/

https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/administer/flow-designer/concept/flow-logic-end-action.html

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

share your script/screenshot

Based on that only we can suggest something

Regards
Ankur

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