How to setAbortAction in a custom action in a flow

GassanHirra
Tera Contributor

I want to abort the insertion of a record if some condition is met in the flow,

I did add the flow logic and everything and i made a custom action and added a script into it, but i can't seem to figure out how to setAbortAction since current.setAbortAction(true); returns this error 
Error: Cannot convert null to an object.,Detail: Cannot convert null to an object.
Any help would be much appreciated, Thanks šŸ™‚ 

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

current.setAbortAction(true) works in before business rule; not sure whether it would work in flow

Mark āœ… Correct if this solves your issue and also mark šŸ‘ Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Yuan Lin
Tera Contributor

@GassanHirra have you tried @Ankur Bawiskar's solution, is it working for your action in the flow?

Priyanka Chandr
Mega Guru

Hi,

Refer the below link that will help you

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

Please mark it correct and helpful

Thanks,

 

Thank you. the link above applies when using either client-side script or server-side business rule to abort an update. However this doesn't answer OP's original question, if those same script would work in a flow.