Flow Designer - PowerShell Step - Ignore Errors

TJ29
Tera Contributor

Hi 

I've got a catalog item that captures information for creating AD groups in a multi row variable set. Upon approval, the variable set is then converted into a CSV via a UI action ready for someone to run a script against it. This has been running for a while now and works well. The next step is to automate this...

I've setup a custom action to send the CSV file to a location on the MID server and then another custom script to create the AD groups. The script works perfectly fine directly in PS via the MID and for the most part it works when executed via Flow Designer > MID Server. The only issue is that when it throws out errors for empty cells in the csv, it errors out the action and the flow dies. 

So the question is...how do I get ServiceNow/the action to IGNORE the errors it throws back and to just carry on?

04/13/22 15:01:49 (833) Worker-Expedited:IPaaSActionProbe-35b6585e1b324510d4eba75b234bcb29 DEBUG: Execution status: failed
04/13/22 15:01:49 (833) Worker-Expedited:IPaaSActionProbe-35b6585e1b324510d4eba75b234bcb29 SEVERE *** ERROR *** Cannot find an object with identity: '' under: 'DC=XYZ,DC=local'.
04/13/22 15:01:49 (833) Worker-Expedited:IPaaSActionProbe-35b6585e1b324510d4eba75b234bcb29 SEVERE *** ERROR *** Operation(AD Group Request Creation.7ea6d45e1b324510d4eba75b234bcbfa.ecea805a1bfe0510d4eba75b234bcbfa) failed with error: com.snc.process_flow.exception.OpException: Powershell execution error

Any help would be greatly appreciated - thank you!

5 REPLIES 5

alexgg57
Tera Expert

accordingly to this:

Cannot find an object with identity: ''

you have empty input - check it why.

TJ29
Tera Contributor

Hi Alex

Thanks for your response. I want it to skip the errors if it detects an empty cell as some groups may not have members or be a member of, if that makes sense!

The groups create etc. and are populated as required but because of the '' it detects, the final status is 'Error'. I just want it to carry on regardless. 

Bimschleger
ServiceNow Employee
ServiceNow Employee

Hi TJ,

In the Rome release, we introduced error handling in Flow Designer.

The most popular use case is catching any errors that happen in a flow.

However, we also introduced granular control within Action Designer, allowing you to move past errors in Action steps. You can see a demo during this Live Code Happy Hour video. Additionally, you can return custom status (success/error, custom codes, etc.) for custom actions now (docs).

In your scenario, you'd want to:

 

  1. Go to your custom action in Action Designer
  2. Navigate to the troublesome Action step
  3. For "When this step fails...", select "Don't stop the action and go to the next step"

 

Alternatively, in the San Diego release, we introduced a "Try" FLow logic, which operates like a standard try/catch block. This could certainly help your situation, too.

TJ29
Tera Contributor

Hi @Brian Bimschleger ,

Thanks for this information it is really helpful. I was planning on kicking on with the DEV clone and upgrade to San Diego this week, so it sounds like now is a good time to get on with it and come back to my above issue once I have the error handling tools at my disposal! 

The video looks very useful too, I'll make sure to finish it!

 

Thanks again

TJ