Working with Conditions

Note: This feature is available only in Connector Wizard 2.0.0.0 and later.

In earlier versions of the Connector Wizard, the success or failure of a call was determined only by the return code. In Connector Wizard 2.0.0.0 and later, you can use the Conditions tab of the Edit REST Operation screen to determine the success or failure of a call in additional ways. For example, if a response contains a field that indicates success or failure, you can make the call succeed or fail based on that field, regardless of the response code. This allows you to set up custom logic that would otherwise have to be defined in a multi-Step Chain.

Note: If you want a call to be considered a success if its response code is less than 400, and a failure otherwise, you do not need to create any Conditions.

Condition Checking

Conditions let you examine the response to a call and then make it succeed or fail based on custom logic. For example, assume you're creating an Operation that makes a call to a server that connects with a database system. When the server receives the call, it (a) checks to see if the database is online, and (b) makes a separate call to a different system to see if it is ready. The server includes the result in a JSON response:

Copy
response: {
    database_online: true;
    backend_response_code: 200;
    ...
}

In order for the call to be considered successful, assume you want database_online to be true AND backend_response_code to be from 200 to 299. In the Response tab, you could set up two Parameters named Database_Online and Backend_Response_Code and map them to the appropriate fields in the JSON response body, like so:

Next, you could configure the Operation's Condition tab to check these values like so:

In the screen shot above, you can see that the Parameters you set up in the Response tab are available in the first dropdown list in each row. The second dropdown list includes comparison operators, and the third field lets you specify a target value.

The fact that this is an AND group indicates that all of the Conditions must be met for the call to be considered successful. If you change it to an OR group, the call will be considered successful if any of the three success criteria are met.

Because we have not configured any Failure Conditions, the call will be considered failed if the Success Conditions are not met. You could create this same configuration like so:

Here, we are using an OR group to make the call fail if database_ready is not true OR backend_response_code is greater than 299. If neither of these Conditions is met, the call is successful.

Note: Failure Conditions take precedence over Success Conditions.

Condition Groups

The example above uses a single Condition Group, but you can also combine multiple Condition Groups. For example, assume that the call should be successful if the database is ready and backend_response is either 200 or 201. You could set this up like so:

This example uses a nested Condition Group. Note that the root Group has AND selected, and the child Group has OR selected.

In this configuration, the inner Condition Group is evaluated first, and then its result is combined with any other Conditions or Condition Groups, using the parent Group's operator. For example, assume database_ready returns true, but backend_response_code returns a 300. The inner Group will evaluate to false, and that will cause the call to fail, because the parent Group is an AND Group.

  • There can be only one root Group for each section (Success Conditions and Failure Conditions).

  • You can use the + Group button to add a child Group to the Group that contains the button.

  • You can use the button to delete the corresponding Group or Condition.

  • You can collapse a Group by clicking the > next to Group.

Retrying Calls

What if you want to keep trying a call until it meets all of the Conditions you have specified? You can accomplish this by setting Run Request to Until Conditions are met.

If you choose this option:

  • You must specify at least one success Condition.

  • The retry interval for the call is defined by the Process Server. You can control it by setting the appropriate Process Server Parameter.

  • The call will continue retrying indefinitely until the Conditions are met. If you want to limit how long it should run for, you can set a runtime limit on the Process Definition that is generated from the Operation.