Handle Exception for Offline Aggregate

Handle Exception for Offline Aggregate

  

I have a simple mobile screen with a form. One of the fields on the form is Name, which I would like to prefill from the user table.

I have achieved this by right-clicking and selecting Fetch Data From Database to create an aggregate GetUserById (passing in GetUserId()). The name field on the form has a variable assigned to it of GetUserById.List.Current.User.Name

When navigating to this screen, if the current user has a name assigned, then the form is prefilled.

If the app goes offline before this screen is navigated to, how can I prevent the error from bubbling up to the global communication exception handler?

Currently the error is thrown and a red exception message is shown at the top of the screen. I would prefer to handle this on the screen itself so that i can choose what to do with the name field, such as filling it with 'Unknown' or leaving it blank.


Solution

Try fetching the data in a separate action (using "Fetch Data from Other Sources") where you can catch the Exception, then return something like an "IsError" flag in case of exception so it doesn't blow out the page.

J.Ja

Solution

Hi Russel,

You can also define a specific On Exception action in your flow where you capture Communication exceptions and do nothing.


Then in, your screen you can test the HasFetchError of your data source and decide what to present to the user.



Cheers,

Tiago.




Thanks guys, I was hoping there was something built into OutSystems, but I can work with the above, so cheers.