Articles in this section

FAQ: How to set up prefill of metadata from context and activity to a form

Published:
Updated:

All data prefill is done through an activity that prefills one or more forms.

To configure a prefill function, we first need to prepare the form and the activity template for prefill.

Prepare the Form in the Designer

For prefill to work, the form element must have the correct Element ID.

  1. Change the Element ID for each field that should be prefilled.
  2. The Element ID should be easy to recognize.

Example:

  • A field that shows the customer name should have the Element ID: customername

Skjermbilde_2026-06-30_kl_081312.png

When all fields that need prefill have the correct Element IDs, save the form.

Prepare the Activity Template

When the form is ready for prefill, add one or more metadata fields to the activity template.

When you enter a Display Name for a metadata field, a Metadata ID is created automatically.

The ID will start with meta. followed by the generated name. The ID must match the Element ID used in the form designer.

Example:

  • Display Name: Customer Name
  • Metadata ID: meta.customername

Skjermbilde_2026-06-30_kl_082618.png

After a metadata field has been added to an activity template and saved, its ID cannot be changed. Because of this, make sure the Display Name matches the Element ID from the designer when you create it. The Display Name can be changed later if needed.

Check the Form Mapping

Open the Forms tab in the activity template.

You will see that the metadata field has been mapped automatically. This happens when the metadata field is added to the activity.

CleanShot_2026-06-30_at_082732.gif

Add the Prefill Code to the Form

After all metadata fields have been added and the Metadata IDs match the Element IDs in the form, click Copy Prefill Code.

Copy the generated code.

CleanShot_2026-06-30_at_082929.gif

Next:

  1. Open the form you want to prefill in the designer.
  2. Select the main form element.
  3. Open the Other tab.
  4. Enable Prefill form with data.
  5. Paste the prefill code you copied.

CleanShot_2026-06-30_at_083058.gif

Save and close the form, then return to the activity template.

The prefill code must be added to every form that should be prefilled.

Create an activity and test the Prefill

When this setup is complete, you can close the activity template.

Prefill will now work automatically. For example, if a customer name is entered on the activity and a new entry is created, the customer name will be filled into the form automatically.

Prefill from Context

Context prefill is also configured through the activity.

You do not need to create the same metadata field on both the activity and the context. The field only needs to exist on the context.

To set up prefill from a context, you must first add the form that will be prefilled to the activity. This allows the system to identify which metadata field in the form should be mapped to the context.

In the activity template:

  1. Open the Forms tab.
  2. Go to Advanced Form Setup.

Here you will see all metadata fields that have been created for the activity.

Click Add Mapping at the bottom of the list.

A list of all form elements will appear, together with the form template each element belongs to.

Select the element that should be mapped to the context.

After adding the mapping, only the Element ID will be shown

CleanShot_2026-06-30_at_083503.gif

Next:

  1. Open Settings in the activity template.
  2. Switch to the Code Editor.
  3. Find the form_context_map section.

CleanShot_2026-06-30_at_083718.gif

Here you will see all metadata fields for the activity.

Find the field that should be prefilled from the context and change its Metadata ID so it starts with contextMeta.

Example:

  • serviceinfo → contextMeta.serviceinfo
Before entering contextMeta. After entering contextMeta.
Skjermbilde_2026-06-30_kl_083905.png
Skjermbilde_2026-06-30_kl_083926.png

After making this change, switch back to the Standard Editor and open the Forms tab. Verify that the Metadata ID has been updated.

CleanShot_2026-06-30_at_084615.gif

Copy the new prefill code and paste it into the form template.

When an activity is created from a context that contains the mapped metadata field, the value will automatically be prefilled into the form.

If an activity is created without a context that contains the mapped metadata field, the prefill will simply not occur. The activity and form will still work normally.

Context data must pass through the activity before it can be added to the form.

Because of this, you must:

  1. Add the form template to the activity.
  2. Map the form field as a metadata field.
  3. Mark that metadata field as coming from the context by changing its ID to contextMeta…

Once these steps are complete, the context data will be passed through the activity and automatically prefill the form. :::

Was this article useful?
yes
No
Help us improve this page
Please provide feedback or comments
Access denied
Access denied