Today, we’ve added new option to improve Call URL error handling to TeamDesk.

Let’s make a quick recap on Call URL logic:

  1. TeamDesk calls third-party server.
    If there is a network error, roll back all changes and display error message.
  2. Then TeamDesk evaluates response status.
    If status indicates error, roll back all changes and display generic message.
  3. Then TeamDesk evaluate Error Message formula, if not empty.
    If formula evaluates to some text, roll back all changes and display text as error message.
  4. Execute assignments and subsequent triggers and actions normally.

This logic works well if third-party server mostly responds with success codes. However it is not always a case.

Consider integration with online payment service. You have your customer’s credit card on file and call a service to charge credit card. Service responds with error. But what kind of?

It could be the result of malformed request. In this case you should definitely stop processing, fix your Call URL action definition and retry. But what if credit card has expired? In this case you should likely mark the record as “failed to process” and notify customer to update credit card information. But at second step TeamDesk aborts all the changes made to the moment and stops all trigger and action execution.

No longer.

Call URL’s On Error new option

New On Error option controls the behavior at step 2.

If set to Stop Execution we use old logic – this option is a default.

If you need greater flexibility, set On Error to Continue Execution. Step 2 will be skipped. Error Message formula, if set, handles both successful and error responses. The formula has a chance to evaluate response status using new ResponseStatus() function. Then it can extract specific error message from server’s response and abort execution if needed, or return NULL to suppress error and continue execution.

If execution is not aborted, you can use assignments to flag whether the record was successfully processed or not, for example:

If(ResponseStatus() = 200, “OK”, “FAILED!”) // to Status