Hi there all
How do I do exception handling when i retrieve data through the integration object when i'm using it as a rule. Do I need to?
We are reading data from the integration object and displaying it on a UI based on data input in other fields. I want to make sure that the UI behaves okay even when the service times out or is not responding.
Discussion posts and replies are publicly visible
To add to the other responder, the best way to do this is to use an if statement with the integration response. So you could do something like this:
a!localVariables( /* Call the integration to query the external system */ local!externalQuery: rule!GetUnsettledTransactionList(), /* Handle the response depending on the outcome */ if( local!externalQuery.success, /* If true, display a grid field with the response details */ a!gridField( data: local!externalQuery.result ), a!textField( readOnly: true, value: "Error returning a response. Error details: " & local!externalQuery.error ) )
Depending on the actual error code from the other system, you could also make your error handling a bit more specific. For example, if a 504 Gateway Timeout is returned (you can get the HTTP Status Code using <variable>.result.statusCode), then you could include a separate if() statement that specifically says something like "Response timed out, please try again later" and display it in a different text box instead of the grid.