Create Ticket My Tickets Post Discussion
Welcome
Login  Sign up

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

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


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.