I need to call a REST API from a WEBCON form and write the returned values back into form fields.
The REST API performs several validations on the incoming JSON payload (e.g. date from valid, date to valid, amount valid, etc.).
In case of a validation error, the API returns something like:
{
"state": "error",
"error_msg": "Date to must be greater than date from"
}
Approach 1 – Automation (menu action)
I trigger the REST call via an Automation started by a menu action.
What works:
The REST call itself
Mapping the response into form fields (e.g. writing error_msg into a field like rest_response)
What does not work:
Field changes done by the Automation do not trigger OnChange business rules (expected behaviour, since the change happens on the backend).
Throwing an Automation error after the REST call only allows static error text – dynamic values (e.g. the error message returned by the REST API) cannot be used.
Menu actions allow a “message on execution success”, but there is no equivalent “message on execution error” that can display dynamic content.
As a result, I can only show something generic like “Error during REST query”, but not the actual validation error returned by the API.
In theory, I could check the REST response for every possible error condition and throw a matching static error message – but this does not scale well and is hard to maintain.
Approach 2 – REST DataSource + Business Rule
I also tried using a REST DataSource called from a Business Rule.
The REST query works fine.
However, a Business Rule can only return a single scalar value.
This means:
One REST call to check whether an error occurred
Additional REST calls (one per field) to retrieve each individual value
For example:
Call 1 → error or no error
Call 2 → value A
Call 3 → value B
Call 4 → value C
…
This would result in 5–6 identical REST calls for a single user interaction, which does not seem like good practice.
Question
Is there a recommended pattern in WEBCON to:
Call a REST API once,
Write multiple returned values into form fields,
And show a dynamic validation error message to the user immediately (without save or path transition),
Without resorting to JavaScript?
Or is this a known architectural limitation of WEBCON?