Skip to main content
Version: 1.28 (Current)

Refresh Form Data from JSON

Audience: Low-code Engineers

Skill Prerequisites: Actions, Forms 2.0, JSON

Sets the values of Forms 2.0 fields from a JSON object, without reloading the page. Each property of the object names a field. Only the fields named in the JSON change.

It's the only refresh action that can set a Repeater's entries directly. It's only available in Forms 2.0, in button actions and other events that run after the form has loaded.

Typical Use Cases​

  • Fill a form from a record returned as JSON, for example by a Server Request to an API
  • Load a set of entries into a Repeater, for example the order lines of an order
  • Restore values saved earlier from [FormData]

Don't use it to​

  • Change one or two simple fields. Refresh Field Data is easier to set up.
  • Fill a Repeater or other fields when the form opens. It's not available in On Preinit, On Page Load or After Fields Initialization. Load a Repeater from its Initial Entries list instead, as shown in Loading a Repeater when the form opens.
Action NameDescription
Refresh Field DataSets the fields you list, one row per field.
Refresh Form Data from ContextRefreshes every field from the tokens with the same name, then ends the actions.
Server RequestCalls an API whose JSON response can be used here.
Create JSON ObjectBuilds a JSON object from tokens.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
JSON StringA JSON object whose properties are field names, for example {"FirstName":"John","LastName":"Doe"}. The JSON in [FormData] can be used here.YesemptyYes
Continue ExecutionWhen checked, the actions after this one run. When unchecked, this action ends the action list.NoFalseNo

Writing the JSON​

The JSON must be an object. Each property sets the field with that name. Fields that aren't named keep their values. Properties that don't match a field set a token with that name instead.

To setWriteExample
A fieldThe field's name and value{"Email":"ana@example.com"}
Fields in a SectionThe Section's name, with an object of its fields. Or each field's full name.{"Billing":{"City":"Cluj"}} or {"Billing:City":"Cluj"}
A Repeater's entriesThe Repeater's full name, with an array of entries. In each entry, name the fields relative to the entry, without the Repeater's name.{"Phones":[{"Number":"0722"},{"Number":"0733"}]}
A Section inside a Repeater entryA nested object in the entry{"Contacts":[{"Name":"Ana","Address":{"City":"Cluj"}}]}

To reuse a token that holds a Section's or Repeater's JSON, wrap it in the full name: {"ContactInfo":[ContactInfo]} or {"ContactInfo:Phones":[ContactInfo:Phones]}.

A Repeater's entries replace the ones on screen. To have them saved later as updates rather than new entries, give each entry its ID under the Repeater's Initial Entry ID Key, for example {"Phones":[{"Id":"12","Number":"0722"}]}.

Loading a Repeater when the form opens​

This action changes a form that is already on screen, after a button click. To show existing entries in a Repeater as soon as the form opens, use the Repeater's own Initial Entries setting instead:

  1. In the form's On Preinit event, create a list with one item per entry. Preinit runs before the fields are initialized, so the list is ready when the Repeater needs it.
  2. Name the list's columns after the fields' full names, for example Lines:Product and Lines:Quantity for a Repeater named Lines. A column with the short name, such as Product, is ignored.
  3. Add a column with each entry's ID, for example Id, if the entries are existing records you want to update later.
  4. On the Repeater, set Initial Entries to the list's name and Initial Entry ID Key to the ID column's name.

The data can come from JSON or from SQL:

  • From JSON, with Create List from JSON. The JSON keys become the column names, so they must be the full names:

    [
    { "Id": "12", "Lines:Product": "Desk", "Lines:Quantity": 1 },
    { "Id": "13", "Lines:Product": "Chair", "Lines:Quantity": 4 }
    ]

    If an API returns short keys such as "Product", rename them with SQL Server's OPENJSON in Create List from SQL instead. Bind the JSON token, for example [LinesJson], to @Json:

    select Id, Product as [Lines:Product], Quantity as [Lines:Quantity]
    from openjson(@Json)
    with (Id nvarchar(50), Product nvarchar(200), Quantity int)
  • From SQL, with Create List from SQL. Give each column the full name with as:

    select l.Id, l.Product as [Lines:Product], l.Quantity as [Lines:Quantity]
    from app.OrderLine l
    where l.OrderId = @OrderId

For a Section inside the Repeater, add its name too, for example Lines:Address:City. For a full walk-through, including saving the changes back, see Initialize entries from existing records on the Repeater page.

Use Refresh Form Data from JSON later, after a button click, to replace those entries, for example when the user picks a different order.

Considerations​

  • An object, not an array. If the JSON starts with [, the action fails and says to wrap the rows in the Repeater's name. Invalid JSON fails with Refresh Form Data from JSON expects a JSON object.
  • Empty JSON does nothing. If JSON String is empty, no field changes.
  • Values are read in order. Each property is set before the next one is read.
  • Continue Execution is off by default. Turn it on if actions must run after the refresh.
  • Conditions. To refresh only in some cases, give it a condition. See Common Parameters.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Fill the form and a Repeater from an API response​

Add this action to a Load order button, after a Server Request that saves the order's customer in [Customer] and its lines in [Lines] as a JSON array. The form has a Customer field and a Repeater named Lines with the fields Product and Quantity.

{
"Title": "Refresh Form Data from JSON",
"ActionType": "RefreshFormDataFromJson.Csp",
"Description": "Show the order and its lines",
"Parameters": {
"JsonString": "{\"Customer\":\"[Customer]\",\"Lines\":[Lines]}",
"ContinueExecution": false
}
}

With [Lines] holding [{"Product":"Desk","Quantity":1},{"Product":"Chair","Quantity":4}], the Repeater shows two entries.

Revised 11/18/2026