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 not have a failover task getting created unless first task actually fails?

snow_beginner
Giga Guru
 
1 ACCEPTED SOLUTION

nityabans27
Kilo Patron

Hi @snow_beginner,

 

You need to return an explicit output variable from the subflow that indicates whether the OIM process actually failed, and then use that variable in your main workflow’s “If” condition to decide whether to create the failover task.

Step 1: Modify the Subflow

In your OIM subflow, after you detect that the OIM task has failed (API response or vendor reference validation failed), set an output variable like this:

 

Outputs.OIM_Failure = true;

And if it’s successful:

 

Outputs.OIM_Failure = false;

You can add this as a new Subflow Output Variable:

  • Name: OIM_Failure

  • Type: Boolean

  • Default: false

Step 2: Update the Workflow “If” Condition

In your main workflow, locate the branch where you currently have:

If Subflow success = Yes/No

Replace or extend that logic to use your subflow’s output instead:

If OIM_Failure == trueCreate failover (internal) Catalog Task Else → Proceed with completion.
That way, the internal/failover task only generates after the subflow confirms the vendor task failed.

View solution in original post

1 REPLY 1

nityabans27
Kilo Patron

Hi @snow_beginner,

 

You need to return an explicit output variable from the subflow that indicates whether the OIM process actually failed, and then use that variable in your main workflow’s “If” condition to decide whether to create the failover task.

Step 1: Modify the Subflow

In your OIM subflow, after you detect that the OIM task has failed (API response or vendor reference validation failed), set an output variable like this:

 

Outputs.OIM_Failure = true;

And if it’s successful:

 

Outputs.OIM_Failure = false;

You can add this as a new Subflow Output Variable:

  • Name: OIM_Failure

  • Type: Boolean

  • Default: false

Step 2: Update the Workflow “If” Condition

In your main workflow, locate the branch where you currently have:

If Subflow success = Yes/No

Replace or extend that logic to use your subflow’s output instead:

If OIM_Failure == trueCreate failover (internal) Catalog Task Else → Proceed with completion.
That way, the internal/failover task only generates after the subflow confirms the vendor task failed.