How is your experience with the OutSystems Community?
24
Views
2
Comments
Solved
Retry api in the form submission only
Question

Hi All,

I wanted to have the retry logic during form submission only not to loose the form  data,

Can any one suggest please,Below calling the api of form filled values and cheking the status of success.

2024-02-16 11-58-28
Sheikh Mohd Fahad
Solution
AI Generated

Hi @Preeti zade  ,

To implement a retry mechanism without losing your form data, you can create a simple Retry Loop directly in your action flow. Because your form inputs are bound to local screen variables, the data will naturally remain intact if an error occurs—as long as you don't navigate away or explicitly clear those variables.

Here is the standard OutSystems approach to build an automated retry loop:

  1. Add a Counter: Create a Local Variable of type Integer named RetryCount (set the default value to 0).

  2. Add an Exception Handler: Drag an All Exceptions handler into your action flow to catch any API failures.

  3. Check the Limit: Inside the Exception flow, add an If widget with the condition RetryCount < 3 (or your desired maximum number of retries).

  4. Loop Back:  If True, use an Assign widget to increment the counter (RetryCount = RetryCount + 1), then drag the connector arrow back to your API call node to try again.

  5. Handle Final Failure:  If False (meaning all retries failed), use a Message widget to show an error to the user (e.g., "Submission failed. Please try again later.") and end the flow.

If the automated retries fail and the flow ends, the user will still see their filled-out form data on the screen and can manually click your submit button again later.

This answer was AI-generated. Please read it carefully and use the forums for clarifications
2023-09-21 12-55-43
SIRAJKHILJI

Hi @Preeti zade 

When the user clicks Submit:

  1. Validate the form.
  2. Call the API.
  3. If success:
    • Show success message.
    • Clear form or navigate away.
  4. If failure:
    • Show error message.
    • Stay on the same screen.
    • Do not reset the form variables.

Submit 

 ↓

Validate  

↓

Call API

  ↓

Success?   Yes → Navigate / Clear Form

No  → Show Error

Keep Form Data

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.