Selected Interventions Echo - Get Task Info, Next or Last Collection Date
- What is it? This formula will return the task ID, last or next collection date for a property and Service Task type
Inputs
This formula requires the following inputs to be passed through to it:
-
the UPRN of the property
The mapped value must come from an address lookup question, using the propery_identifier variable option.
-
The Service Task type ID
The ID of the type of service task to be returned.
-
The value to return
Available options are:
- Task ID
- Service Task Indicator ID
- Last Task Core State
- Last Task State Name
- Last Task State Reference Key
- Last Task State Reference Type
- Last Task State Reference Value
- Last Task date
- Next Task Core State
- Next Task State Name
- Next Task State Reference Key
- Next Task State Reference Type
- Next Task State Reference Value
- Next Task date
-
From Date
Must be in a YYYY-MM-DD format. This date can be populated from the Date Plus/Minus Days Logic.
-
To Date
Must be in a YYYY-MM-DD format. This date can be populated from the Date Plus/Minus Days Logic.
Return values
Value | Description |
---|---|
The value as selected from the return values input | In the event that a service task was found with the desired property. |
[error] | If the integration is disabled or an error occurred, as detailed below. |
[none] | If the last or next task is desired but it doesn't exist against the task. |
An empty string | If the service task was found but does not have the requested property. |
Formula Logic
- A check is made to see if the integration has been enabled in the Settings > Integrations page. If the integration is not enabled the formula returns
[error]
. - A check is made against the provided UPRN, Task Type ID and From Date. If any are empty, or the Task Type ID is not numeric, the formula returns
[error]
. - If either the From Date or To Date fields have not been provided in the expected format (YYYY-MM-DD), the formula returns
[error]
. - A lookup is performed with the Selected Interventions Echo API using the provided inputs.
- If the Selected Interventions Echo has returned an unexpected response, the formula returns
[error]
. - If the desired return value is one for the last service task, and no last task has been returned from the API, the formula returns
[none]
. - If the desired return value is one for the next service task, and no next task has been returned from the API, the formula returns
[none]
. - If the desired service task has been returned, but the desired property for that task has not (e.g. a next task type was returned, but no next task state name was returned), the formula returns an empty string.
- If the desired return value is the last or next task date, but the returned task has no scheduled date, the formula returns the original scheduled date for the task.
- Otherwise, the formula returns the value for that service task property.