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 pre-populated 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 "{{field1}}".

{
"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"
}
JavaScript

Scenario 2 - Repeatable Data

Assigning a task and pre-populating 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.

 Pre-populating 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"
}
JavaScript


    • Related Articles

    • POST Task

      TABLE OF CONTENTS Parameters Example 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 ...
    • PUT Task

      TABLE OF CONTENTS Parameters Example This request method allows you to update an existing task. This API is available via SSL-secured HTTPS connection on the Cloud using the REST PUT verb. The format query string parameter controls the desired ...
    • GET Task (Search)

      TABLE OF CONTENTS Parameters Example Additional Info API Explorer This request method allows you to find all tasks matching the given criteria. On the Cloud, this API is available via SSL-secured HTTPS connection using the REST GET verb. The format ...
    • POST Screen

      TABLE OF CONTENTS Parameters Example The POST Screen Form API allows you to create a form programmatically rather than in the designer. On the Cloud, this API is available via SSL-secured HTTPS connection using the REST POST verb. The format query ...
    • POST Folder

      The POST Folder API creates a new folder in the company's account. 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 ...