Activity Results Templates

Activity Results Templates provide templates for collecting the results of activities performed by employees. When stopping an activity, employees will be prompted for results when an activity results template has been associated with that activity.

Note: Activity Results Templates can be configured to have up to two levels. When an employee stops an activity configured with a two level activity results template, they will be prompted to enter results for the activity at the first level and will then be prompted to enter additional results at the second level based on the results that were entered at the first level.

Prerequisites

You should create activities before creating activity results templates.

Example

In this example, we create, verify, update, and delete an activity results template.

Create an activity results template

The create request:

  • creates a new activity results template named: Example Activity Forms
  • uses the forms array to include every example activity form in the system using object references
  • does not set this activity results template as the system default

Example request

Call the Create Results Template POST /v1/work/results_templates operation with the following request payload.

{
    "name": "Example Activity Results Template",
    "description": "This template illustrates an example collection mechanism for the results of an activity.",
    "version": 1,
    "steps": [
        {
            "prompt": "How many completed?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -6,
                "qualifier": "_Completed Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": true,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many completed?"
        },
        {
            "prompt": "How many scrapped?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -33,
                "qualifier": "_Scrapped Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": false,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many scrapped?"
        }
    ],
    "default": false
}

Example response

A success response returns HTTP status code 200 and a response body similar to the following example.

{
    "id": 54,
    "name": "Example Activity Results Template",
    "description": "This template illustrates an example collection mechanism for the results of an activity.",
    "version": 1,
    "steps": [
        {
            "id": 58,
            "prompt": "How many completed?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -6,
                "qualifier": "_Completed Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": true,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many completed?"
        },
        {
            "id": 59,
            "prompt": "How many scrapped?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -33,
                "qualifier": "_Scrapped Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": false,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many scrapped?"
        }
    ],
    "default": false
}

Verify

To verify, call the Retrieve Results Template by ID GET /v1/work/results_templates/{id} or the Retrieve All Results Templates or by Name GET /v1/work/results_templates?name={name} operation.

Calling GET /v1/work/results_templates/1 or GET /v1/work/results_templates?name=Example Activity Results Template returns:

{
    "id": 54,
    "name": "Example Activity Results Template",
    "description": "This template illustrates an example collection mechanism for the results of an activity.",
    "version": 1,
    "steps": [
        {
            "id": 58,
            "prompt": "How many completed?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -6,
                "qualifier": "_Completed Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": true,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many completed?"
        },
        {
            "id": 59,
            "prompt": "How many scrapped?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -33,
                "qualifier": "_Scrapped Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": false,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many scrapped?"
        }
    ],
    "default": false
}

Note: The Retrieve All Results Templates or by Name GET /v1/work/results_templates?name=Example Activity Results Template operation returns the object above enclosed in an array, since omitting the name query parameter returns all activity results templates in the system.

Note: The Retrieve All Results Templates or by Name GET /v1/work/results_templates operation without the name query parameter returns all activity results templates but omits the details inside the steps array.

Update the activity results template

To update the activity results template to disable the inital results option for the first step, call the Update Results Template by ID PUT /v1/work/results_templates/54 operation with the following request payload.

Example request

{
    "id": 54,
    "name": "Example Activity Results Template",
    "description": "This template illustrates an example collection mechanism for the results of an activity.",
    "version": 1,
    "steps": [
        {
            "prompt": "How many completed?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -6,
                "qualifier": "_Completed Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": false,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many completed?"
        },
        {
            "prompt": "How many scrapped?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -33,
                "qualifier": "_Scrapped Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": false,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many scrapped?"
        }
    ],
    "default": false
}

Example response

{
    "id": 54,
    "name": "Example Activity Results Template",
    "description": "This template illustrates an example collection mechanism for the results of an activity.",
    "version": 2,
    "steps": [
        {
            "id": 60,
            "prompt": "How many completed?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -6,
                "qualifier": "_Completed Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": false,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many completed?"
        },
        {
            "id": 61,
            "prompt": "How many scrapped?",
            "matchFieldLength": false,
            "fieldDefinition": {
                "id": -33,
                "qualifier": "_Scrapped Quantity Code"
            },
            "fieldType": {
                "id": 0,
                "qualifier": "Alpha numeric"
            },
            "entryType": {
                "id": 1,
                "qualifier": "Required"
            },
            "validationType": {
                "id": 1,
                "qualifier": "In List"
            },
            "inputSourceType": {
                "id": 0,
                "qualifier": "Any"
            },
            "initialResult": false,
            "multiSelect": false,
            "stepType": {
                "id": 1,
                "qualifier": "Decision"
            },
            "decisionAnswers": [],
            "name": "How many scrapped?"
        }
    ],
    "default": false
}

Note that the version is automatically incremented to 2. To successfully update this profile again, you must pass version 2 in the request body.

Delete the activity results template

To delete this activity results template, call the Delete Results Template by ID DELETE /v1/work/results_templates/54 operation.

The system returns HTTP status 204 with an empty response body.