Skip to main content

Manual trigger parameters

Input parameters for manual workflows

For manual workflows only, you can define a set of parameters on its trigger. It enables the workflow to take input and adapt its actions according to the supplied values. These are set at runtime, either by supplying values via the API, or by automatically displaying a dialog to collect user input.

It involves creating a parameter design to store one or more parameter attributes, which can then be referenced by the actions of a manual workflow.

Define trigger parameters

To define a set of trigger parameters for a manual workflow:

  1. Create a new design (Swagger/ReDoc).

    POST /api/design
    {
    "name": "My Trigger Parameters",
    "colour": "#8b8b8b",
    "icon": "icon-file-code",
    "geometryRequired": false,
    "geometryAllows": [],
    "collections": ["Live"]
    }
    Note

    In the following steps, substitute {code} in the endpoint URL with your new design's code, e.g. designs_myTriggerParameters_667b063d535060cadd3605e9.

  2. Edit the design to make it implement the Manual Workflow Trigger interface (Swagger/ReDoc).

    POST /api/design/{code}/interface
    {
    "interfaceCode": "designInterfaces_workflowManualTrigger",
    "signature": "667b063d535060cadd3605eb"
    }
  3. Add one or more attributes to your design (Swagger/ReDoc). Each attribute will serve as a parameter. If an attribute is set as Required, a value must be supplied for that parameter when the manual workflow is run.

    POST /api/design/{code}/attribute
    {
    "name": "InputNumber",
    "required": true,
    "readonly": false,
    "unique": false,
    "options": {
    "decimalPlaces": 0,
    "min": 1,
    "max": 50,
    "discriminator": "DodiAttributeOptionsNumberWebModel"
    },
    "signature": "667b06c6535060cadd362355"
    }
  4. Create or edit a workflow with a manual trigger and set its parametersDesignCode to your new design's code (Swagger/ReDoc).

    POST /api/workflow
    {
    "name": "My Example Workflow",
    "enabled": true,
    "description": "A manual workflow that uses trigger parameters",
    "trigger": {
    "dodiCode": "designs_myExampleDesign_667b0926535060cadd36fa1f",
    "outputMode": "ManyItems",
    "parametersDesignCode": "designs_myTriggerParameters_667b063d535060cadd3605e9",
    "discriminator": "ManualTrigger"
    },
    "failureNotification": {
    "username": "tobylerone"
    }
    }

Use trigger parameters in actions

When adding or editing the actions of the workflow, you can use a trigger parameter by defining it as an action parameter, or as a variable that all actions in the workflow can access.

Currently, this is only possible via the Alloy API.

Trigger the workflow

If a user triggers the manual workflow in Alloy Web, they'll be prompted to enter values for the workflow's parameters. Required parameters display an asterisk * and must be populated to continue.

An Alloy Web dialog requesting parameter values for the triggered workflow

Alternatively, if the manual workflow is triggered via the API, parameter values can be supplied as needed (Swagger/ReDoc).

POST /api/workflow/{code}/manual-run
{
// optional AQS query to fetch items of a design/interface as input for the workflow
"query": {
"type": "Query",
"properties": {
"attributes": ["attributes_itemsTitle", "attributes_itemsSubtitle"],
"collectionCode": ["Live"],
"dodiCode": "designs_myExampleDesign_667ad66a535060cadd25f65b"
}
},
// supply values for attributes of the workflow's 'parametersDesignCode'
// required attributes require values for the workflow to run!
"triggerParameters": [
{
"attributeCode": "attributes_myTriggerParametersInputNumber_667b0926535060cadd36fa1e",
"value": 42
}
]
}
Note

In the above step, substitute {code} in the endpoint URL with your workflow's code, e.g workflows_myExampleWorkflow_667b10cb535060cadd396e59.