Pre-filling of a Form Entry Activity (POST Task)

Pre-filling of a Form Entry Activity (POST Task)

Our platform’s Tasks & Dispatch feature (only available to premium users) is a great way to streamline your operations. Allowing you to assign tasks to your workers easily while also giving you various ways to keep track of the status of the assigned tasks through to completion.

If you’ve outgrown the features of our web-based interface for creating tasks, a popular way to create tasks programmatically is through our Task API.

Suppose you would like to create a task through the POST Task API, and when assigning that task, you’d like to prepopulate some of the fields in the form being assigned to the worker for completion. Below is some sample JSON code that shows how this can be achieved for forms that:


Scenario 1 – Singular Data

Assigning a task and prepopulating fields in an activity form.

The JSON Body format below can be used in a REST Field and a REST Connector.

Form Answers

“Name” = The data name of the field in the activity task form to fill out.

“Value” = A static “this text/value” or dynamically referencing a field’s data name from the form creating the task “o}xoxfield1}}”.

{
"UserEmail": "user@example.com",
"Name": "MORNING timesheet for PROJECT-001",
"Icon": "Clock",
"CompleteBy": "2019-03-15T00:00:00.0000000Z",
"StartBy": "2019-03-14T18:00:00.0000000Z",
"Activities": [
{
"ActivityType": "FillOutForm",
"FormExternalId": "TIMESHEET",
"FormAnswers": [
{
"Name": "work_date",
"Value": "2019-03-14"
},
{
"Name": "project_num",
"Value": "PROJECT-001"
},
{
"Name": "worker",
"Value": "Ben Doe - 54321"
},
{
"Name": "exist_class",
"Value": "Scaffolders - Advanced Level 2"
},
{
"Name": "labour",
"Value": "12.00"
}
]
}
],
"CompanyId": XXXXX,
"IntegrationKey": "XXXXXXX"
}

Scenario 2 – Repeatable Data

Assigning a task and prepopulating repeating fields in an activity form.

If you are prepopulating fields in a table or on a repeatable page, then your JSON Body will require using {{!REPEATSTART}} and {{!REPEATEND}} to iterate through the repeating fields and values.

Prepopulating repeatable data is achieved using a REST Connector.

{
"UserEmail": "test@example.com",
"Name": "Test Task {{task_num}}",
"Icon": "Clock",
"CompleteBy": "2023-05-15T00:00:00.0000000Z",
"StartBy": "2023-05-14T18:00:00.0000000Z",
"Activities": [
{
"ActivityType": "FillOutForm",
"FormExternalId": "my_test_app",
"FormAnswers": [

{
"Name": "page1",
"Type": "Group",
"Answers": [
{

"Name": "client_name",
"Value": "{{client_name}}"
},
{
"Name": "client_account_number",
"Value": "{{client_account_number}}"
},
{
"Name": "client_email",
"Value": "{{client_email}}"
},
{{!REPEATSTART}}
{
"Name": "table",
"Type": "RepeatGroup",
"Answers":
[
{
"Name": "product",
"Value": "{{product}}"
},
{
"Name": "quantity",
"Value": "{{quantity}}"
}
]
},
{{!REPEATEND}}
]
}
]
}
],
"CompanyID": XXXXX,
"IntegrationKey": "995XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
    • Related Articles

    • POST Task

      The Tasks API allows you to retrieve, create and delete Tasks on the platform. This enables scenarios where jobs created/maintained in other systems (e.g. SAP, Salesforce) can be delivered through to your app users automatically. Any new Task created ...
    • POST Task (Files)

      This request method allows you to upload files for a given task. On the Cloud, this API is available via SSL-secured HTTPS connection using the REST POST verb. The format query string parameter controls the desired response format. Specify either XML ...
    • POST Task Recurring (Files)

      This request method allows you to upload and replace files for a recurring task. On the Cloud, this API is available via SSL-secured HTTPS connection using the REST POST verb. The format query string parameter controls the desired response format. ...
    • POST Task

      This request method allows you to create a new task and assign it to a specified user(s). On the Cloud, this API is available via SSL-secured HTTPS connection using the REST POST verb. The format query string parameter controls the desired response ...
    • GET Task

      The Tasks API allows you to retrieve, create and delete Tasks on the platform. This enables scenarios where jobs created/maintained in other systems (e.g. SAP, Salesforce) can be delivered through to your app users automatically. Any new Task created ...