Introduction to Workflow Service

Workflow Service lets you register Execution Workflows using the existing Execution Tasks and Execution Macro. Updating an existing Workflow within the service registers a new version of that Workflow. Moreover, after the Workflow expires, no additional updates to that Workflow are allowed.

With this basic overview, let's get into the details regarding Execution Task, Execution Macro, Execution Workflow, and its Instance.

Execution Task

An Execution Task (ET) is the smallest atomic task that is performed by an operator. The ET has a binary outcome, i.e., it can either succeed or fail. An ET can’t be canceled; only the ET workflow or Objective can be canceled.

Some example execution tasks are: scan, collect, verify, capture, stop, start, custody in, custody out, etc.

In an Execution Workflow, there are multiple Execution Tasks. Each task has its own unique ID attached to it.

Components of an Execution Task

An execution task has the following components:

Component NameDescription
IDThis is the ET ID, a unique human-friendly string for the Execution Task.
NameName defined for an Execution Task. Example: Collect, capture, scan, verify, etc.
Input ParametersInput parameters allow you to pass a set of information during the invocation of an ET for further use. These parameters vary depending on the ET.

Example:
ET_COLLECT: Amount to be collected from the consignee or allowed payment gateways.
ET_VERIFY: Types of verification, i.e., OTP or ID.
ET_CAPTURE: Size of the image to be captured.
Output Status & DataAn ET has binary outcomes. The two possible terminal statuses are: ET_SUCCESS and ET_FAILURE. Both the status can return additional data with it to represent the outcome.

This data doesn't affect the workflow in any way. This is just additional information captured and shared with other applications/systems. Example: Barcode value is returned with the output status in the case of ‘Scan Code’.
1920

Every Execution Task has a Completion Mode. This completion mode describes the outcome of an Execution Task which can either be a success or a failure. With that, the ET also has a Reason Code that describes the outcome of the task. These are a set of pre-defined descriptions based on the outcome of the task.

The Delivery Agent (DA) mobile app exists on every FE’s device. For every Execution Task, a corresponding pre-coded module is expected in the app as part of SDK. This module executes the Task on the device running the DA app.

In other words, the app already has the set of instructions for the FE telling him what to do at a particular stop. The Mobile App SDK orchestrates the execution of Tasks.

States of an Execution Task

An Execution Task has the following defined states:

  • Pending
  • Active
  • Success
  • Failure
  • Obsolete

The state of an Execution Task is defined by the task’s prerequisites. The prerequisite field of an Execution Task is a collection of Completion Mode and other Execution Tasks.

The state of the Execution Task is IMPLICIT and does not need to be advanced by command or any other process. It is primarily used by the UI to determine what to show the user.

The following example shows the progression of states of an ET:

Suppose there are two different Execution Tasks, i.e., ET-1 and ET-2. ET-1 has no prerequisites and ET-2 is dependent upon ET-1 having a Completion Mode of type ‘fail’. ET-2 will become active when ET-1 is marked completed with ‘fail’ and a Completion Mode is attached. Here is a simplified representation:

2194

All Execution Tasks must end in success or failure. However, it is possible to set a prerequisite for an Execution Task based on the Reason Code of a Completion Mode for another task. It is, therefore, possible to have more than two divergent paths from a single Execution Task:

1920

To perform Execution Tasks, its state must be ‘active’. If none of the Execution Tasks within a Workflow remain active, the Workflow reaches its terminal state.

Default Execution Tasks

The platform provides default Execution Tasks that you can add to your workflow. The table below includes all the Execution Tasks with IDs. Use these IDs while creating an Execution Workflow.

Execution TaskExecution Task IDFunctionalityInput ParametersOutputOn Failure
VerifyLocationetask:7f3897da-3a1f-5736-b8e5-5d9f131b13cdAbility to verify if the rider is at a certain location.1. addressString
2. latitude
3. longitude
4. radius (for geofence confirmation)
5. accuracyForGeolocation
1. Success: true/false
2. eventCode: WfS/WfF
3. reasonCode
Failure
CaptureImageetask:9370d00a-8d84-5bf9-94bb-cd8cc73eeeecAbility to capture image.1. Image Resolution
2. fileSizeLimit
3. captureMode [SINGLE, MULTI]
4. captureCountLimit
1. Success: true/false
2. captures: [imageUrl, timestamp]
3. eventCode: ImgS/ImgF
4. reasonCode
Failure
CaptureInputetask:7b5637cc-570e-5c9d-b184-ecfbbd7c198dAbility to capture a number or string input.1. inputType: String, Number
2. validationRegex
1. Success: true/false
2. value
3. isValid
4. attemptCount
5. eventCode: CinS/CinF
6. reasonCode
Scanetask:28cba55d-2aad-5568-863a-9e7e645f8c7bAbility to scan a barcode or QR Code.1. scanType: [Barcode, QRCode, Both]
2. scanMode: SINGLE, MULTI
3. scanCountLimit
4. validationRegex
1. Success: true/false
2. scans: [value, isValid, timestamp]
3. eventCode: ScanS/ScanF
4. reasonCode
Failure
Doodleetask:cea7c9a7-3ee7-52e9-ab3e-82849675d745Ability to capture a finger-tip trace on screen.1. Pen colour
2. FileSizeLimit
3. Dimension
1. Success: true/false
2. imageUrlOfDoodle
3. eventCode: DoS/DoF
4. reasonCode
Failure
Formetask:80446347-ede5-5cf9-8e56-b3d59fda4b5cAbility to collect multiple information in a custom defined form.Custom Form JSON (question, question type, validations)1. Success: true/false
2. Response [answers]
3. eventCode: FormS/FormF
4. reasonCode
Failure
Displayetask:574ff9b0-c49c-5eb5-b550-8548ae0cab44Ability to display an alert message, information, warning, etc to the operator.1. displayType: [Alert, Warning, Message]
2. Text
3. ImageUrl
1. Success: true/false
2. eventCode: DisS/DisF
3. reasonCode
Failure
Picketask:04d2414c-ddc1-552e-af02-78073dbb8ff7Pick (Execution Task) is when the inventory transfer is Receivables (In). This is used to maintain track of ownership of goods and cash.1. Items: [{sku, count, productDescription}]
2. allowCustodyExchange-
TRUE: double confirmation would be required. Applicable for custody change
FALSE: Single confirmation only required. Applicable for normal pickup
1. Success: true/false
2. Remark: text
3. eventCode: PS/PF
4. reasonCode
Deliveretask:dcac5d49-c54c-5c38-a780-ad2e9ba5e2e2Deliver (Execution Task) is when the inventory transfer is Payables (Out).1. Items: [{sku, count, productDescription}]
2. allowCustodyExchange-
TRUE: double confirmation would be required. Applicable for custody change
FALSE: Single confirmation only required. Applicable for normal pickup
1. Success: true/false
2. Remark: text
3. eventCode: DS/DF
4. reasonCode
Startetask:952f3754-12e8-5ff2-93a8-aca383d18e56Ability to start a workflow. It is mandatory.1. Success: true/false
2. eventCode: Start/StartF
3. reasonCode
Completed-Successetask:134e93b4-49a8-59b9-bc6c-7bd9045728ffAbility to define if the terminal endpoint of a workflow is successful.1. Success: true/false
2. eventCode: CSS/CSF
3. reasonCode
Completed-Failureetask:e04ab83d-2a02-5970-ade9-e2a8a879b200Ability to define if the terminal endpoint of a workflow is failure.1. Success: true/false
2. eventCode: CFS/CFF
3. reasonCode
InitPaymentetask:4eb8d36b-6762-5c53-aca6-95b1f4e3aa3fTo instruct the app layer to initiate payment flow with payment data.1. Amount
2. allowedPaymentMode
1. Success: true/false
2. transactionID
3. paymentMode
4. eventCode: IniS/IniF
5. reasonCode
ProcessPaymentetask:9a559375-02a5-50fe-9ce4-0a36df6f324eTo process a payment and generate transaction IDs.1. Amount
2. allowedPaymentMode
1. Success: true/false
2. transactionID
3. collectedAmount (incl. currency)
4. paymentMetaData
5. eventCode: PPS/PPF
6. reasonCode
CompletePaymentetask:0e6c7bd7-c9ab-5b82-85b2-a054249bc1f1To record final details of payments (tenant payID, transaction ID, amount etc).1. expectedAmount
2. collectedAmount
3. transactionID
4. tenantTransactionID
1. Success: true/false
2. eventCode: CPS/CPF
3. reasonCode
VerifyInputetask:6fc10a60-a144-5798-97f3-1f12e77f56e2Ability to verify if the given input matches the response from an API or static value.1. anyOf Input, value
2. Input, apiURL, JsonPathOfValue
3. maxAttemptAllowed
4. attemptCount
1. Success: true/false
2. eventCode: ViS/ViF
3. reasonCode
DeliverCashetask:2fffdf62-62b3-5e70-bd9e-d4d2644ee2feAbility to deliver cash.1. expectedAmount1. Success: true/false
2. eventCode
3. reasonCode

Reversing Execution Tasks

If needed, it is possible to undo Execution Tasks and go backward. However, some actions or exchanges of custody in the course of executing the task should be reversed.

This allows for the correction of mistakes a worker might have made or reacting to changes in circumstances in the field. Some Execution Tasks are NOT reversible and must be defined as such. If a Reverse Action is defined on an Execution Task, that action must be completed to modify the Completion Mode.

1748

Execution Macro (EM)

You can combine one or more Execution Tasks together in a logical sequence that can be reused. This is called an Execution Macro.

Execution Macros let the tenant create reusable blocks of template for business flow components. In other words, there might be a sequence of execution tasks that remain saved for recurring workflows. In that case, rather than manually creating the same workflow over and over, you can create an Execution Macro and attach it wherever you need it in a workflow.

These reusable templates help to define a subset of the bigger logistical process. These templates can be re-used and can be edited in one place to allow the propagation of changes throughout the universe of the Tenant. This helps drive standardization for identical processes.

Components of an Execution Macro

The Execution Macro has the following components:

Component NameDescription
IDThis is the EM ID, a unique human-friendly string for the Execution Macro.
NameName defined for an Execution Macro. Example: B2C-POD, VerifyCustomer, DeliverContainer etc.
Input ParametersInput parameters allow you to pass a set of information during the invocation of the first Execution Task in an Execution Macro.
Output StatusAn Execution Macro has binary outcomes. The two possible terminal statuses can be: EM_SUCCESS and EM_FAILURE.

Note: Please don’t confuse them with ET_Success and ET_Failure

System Defined Macros

System Defined MacroMacro IDFunctionalityInput ParametersOutputOn Failure
CollectPaymentemacro:c014eb65-8944-5320-8e51-dccad861a086Ability to collect specified amounts through allowed modes of payment.
This system defined macro is combination of three tasks InitPayment, Process Payment, Complete Payment.
1. Amount
2. allowedPaymentMode: ["CASH", "UPI", "PAYMENT_LINK"]
3. tenantTransactionID
4. transactionID
5. collectedAmount
1. Success: true/false
2. paymentMeta
3. transactionID
4. eventCode: WfS/WfF
5. reasonCode
Failure

Example Execution Macro

Let's suppose, there is a Tenant A with the following Execution Task Workflows in his universe:

  • VerifyCustomer: To correctly identify if the person receiving the package is authorized to collect it or not.
  • B2C-POD: To take the proof of delivery through a signature or photos.
  • DeliverContainer: To verify if the package picked by the Operator is correct and then hand it over to the consignee. A maximum of 3 retries is allowed for the Operator to scan the correct package.

So, the complete Execution Workflow (VerifyCustomer+B2C-POD+DeliverContainer) has multiple Execution Tasks in it. The Execution Tasks within VerifyCustomer ET Workflow are coupled together to form an Execution Macro. Similarly for B2C-POD & DeliverContainer as well.

These Execution Macros can be reused in multiple Execution Workflows. Execution Task Workflows, as a sequence of Execution Tasks, are illustrated below:

1748

These individual templates are used as Execution Macros.

Execution Workflow

The operator needs to perform a set of tasks in a pre-defined manner. The sequence of these Execution Tasks is defined as Execution Workflow.

Every objective has an Execution Workflow attached to it. To complete the objective, the operator needs to perform the Execution Workflow. This Execution Workflow consists of one or more Execution Tasks and/or Execution Macros.

There is an Execution Workflow Designer which is basically a browser-based drag-and-drop tool. It has all the defined Execution Tasks. The tenant can further use the Execution Workflow Designer to create and store Execution Workflows and Execution Macros.

Here is a graphical representation of multiple Execution Tasks & Execution Macro forming an Execution Workflow:

1920

To create to register an Execution Macro, call the Register a workflow endpoint. Before that, check out Execution Task and Macro Payload.

Request bodies are specified in JSON format. The following examples show a request body for registering an Execution Workflow:

🚧

Defining Execution Macro in an Execution Workflow

When you define an Execution Macro for a particular Execution Task in an Execution Workflow, please follow this format: Macro_Task. Example: CollectPayment_InitPayment. Here, the CollectPayment is a Macro that is used for the InitPayment Execution Task.

📘

Entity, Event, and Reason Codes

Check out the list of Entity, Event, and Reason Codes here.

MemberDescriptionValidationData type
nameName of the Workflow.minLength: 1
maxLength: 24
pattern: ^[a-zA-Z0-9-_]{1,24}$
string
descriptionDescription of the Workflow.minLength: 1
maxLength: 150
string
tag>nameTag name.minLength: 1
maxLength: 10
string
tag>valueTag value.minLength: 1
maxLength: 10
string
flowsETs/EMs for the workflow.
flows>nextDisplay name of the Execution Task.string
flows>idUnique ID of the Execution Task.string
flows>descriptionDescription of the Execution Task.string
taskThe task to be performed if the condition is validated.string
input>$exprExpression of defined inputs.string
input>$valValue of the inputs.
oneOfList of Execution Tasks that are allowed within this Execution Macro.string, boolean, number
{
 "name": "test_cod_latest_1",
 "description": "cod Drop Workflow",
 "tag": [
   {
     "name": "OBJECTIVE",
     "value": "Drop"
   },
   {
     "name": "mode",
     "value": "cod"
   }
 ],
 "flows": [
   {
     "name": "Start",
     "id": "etask:952f3754-12e8-5ff2-93a8-aca383d18e56",
     "description": "Start ET",
     "next": [
       {
         "condition": "webWfStarted",
         "task": "WebCollectPayment"
       },
       {
         "condition": "wfStarted",
         "task": "CollectPayment"
       },
       {
         "condition": "wfFailedVerifyLocation",
         "task": "VerifyLocation"
       },
       {
         "condition": "wfFailedForm",
         "task": "Form"
       },
       {
         "condition": "wfFailedDisplay",
         "task": "Display"
       }
     ]
   },
   {
     "name": "CollectPayment",
     "id": "emacro:c014eb65-8944-5320-8e51-dccad861a086",
     "description": "Collect Cash Macro",
     "next": [
       {
         "condition": "paymentSuccess",
         "task": "Doodle"
       },
       {
         "condition": "paymentFailure",
         "task": "Completed-Failure"
       }
     ]
   },
   {
     "name": "WebCollectPayment",
     "id": "emacro:c014eb65-8944-5320-8e51-dccad861a086",
     "description": "Collect Cash Macro for Web",
     "next": [
       {
         "condition": "paymentSuccess",
         "task": "Deliver"
       },
       {
         "condition": "paymentFailure",
         "task": "Completed-Failure"
       }
     ]
   },
   {
     "name": "Doodle",
     "id": "etask:cea7c9a7-3ee7-52e9-ab3e-82849675d745",
     "description": "Take signature",
     "next": [
       {
         "condition": "doodleSuccess",
         "task": "Deliver"
       },
       {
         "condition": "doodleFailed",
         "task": "CaptureImage"
       }
     ]
   },
   {
     "name": "CaptureImage",
     "id": "etask:9370d00a-8d84-5bf9-94bb-cd8cc73eeeec",
     "description": "Capture Image",
     "next": [
       {
         "condition": "captureImageSuccess",
         "task": "Deliver"
       },
       {
         "condition": "captureImageFailed",
         "task": "CaptureImage"
       }
     ]
   },
   {
     "name": "Deliver",
     "id": "etask:dcac5d49-c54c-5c38-a780-ad2e9ba5e2e2",
     "description": "Deliver",
     "next": [
       {
         "condition": "deliverSuccess",
         "task": "Completed-Success"
       },
       {
         "condition": "deliverFailed",
         "task": "ReturnPayment"
       }
     ]
   },
   {
     "name": "ReturnPayment",
     "id": "etask:2fffdf62-62b3-5e70-bd9e-d4d2644ee2fe",
     "description": "Drop cash ET",
     "next": [
       {
         "condition": "dropSuccess",
         "task": "Completed-Failure"
       },
       {
         "condition": "dropFailed",
         "task": "ReturnPayment"
       }
     ]
   },
   {
     "name": "Form",
     "id": "etask:80446347-ede5-5cf9-8e56-b3d59fda4b5c",
     "description": "Form ET",
     "next": [
       {
         "condition": "formSuccess",
         "task": "Completed-Failure"
       },
       {
         "condition": "formFailed",
         "task": "Form"
       }
     ]
   },
   {
     "name": "Display",
     "id": "etask:574ff9b0-c49c-5eb5-b550-8548ae0cab44",
     "description": "Display ET",
     "next": [
       {
         "condition": "displaySuccessRescheduled",
         "task": "Form"
       },
       {
         "condition": "displaySuccess",
         "task": "Completed-Failure"
       }
     ]
   },
   {
     "name": "VerifyLocation",
     "id": "etask:7f3897da-3a1f-5736-b8e5-5d9f131b13cd",
     "description": "Verify Location",
     "next": [
       {
         "condition": "verifyLocationSuccess",
         "task": "Completed-Failure"
       },
       {
         "condition": "verifyLocationFailed",
         "task": "Completed-Failure"
       }
     ]
   },
   {
     "name": "Completed-Success",
     "id": "etask:134e93b4-49a8-59b9-bc6c-7bd9045728ff",
     "description": "Success ET",
     "next": []
   },
   {
     "name": "Completed-Failure",
     "id": "etask:e04ab83d-2a02-5970-ade9-e2a8a879b200",
     "description": "Failure ET",
     "next": []
   }
 ],
 "inputs": {
   "Doodle": {
     "$val": {
       "resolution": {
         "$val": {
           "length": {
             "$expr": "$.inputs.resolution.length",
             "$val": 512
           },
           "breadth": {
             "$expr": "$.inputs.resolution.breadth",
             "$val": 512
           }
         }
       },
       "fileSizeLimit": {
         "$expr": "$.inputs.fileSizeLimit",
         "$val": 500
       },
       "title": {
         "$expr": "$.inputs.doodleTitle",
         "$val": "Customer Signature"
       },
       "message": {
         "$expr": "$.inputs.doodleMessage",
         "$val": "Please ensure that the signature is clear"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": []
           }
         }
       }
     }
   },
   "CaptureImage": {
     "$val": {
       "resolution": {
         "$val": {
           "length": {
             "$expr": "$.inputs.resolution.length",
             "$val": 512
           },
           "breadth": {
             "$expr": "$.inputs.resolution.breadth",
             "$val": 512
           }
         }
       },
       "fileSizeLimit": {
         "$expr": "$.inputs.fileSizeLimit",
         "$val": 500
       },
       "captureMode": {
         "$expr": "$.inputs.captureMode",
         "$val": "SINGLE"
       },
       "title": {
         "$expr": "$.inputs.captureImageTitle",
         "$val": "Photo of Delivered Package"
       },
       "message": {
         "$expr": "$.inputs.captureImageMessage",
         "$val": "Please ensure that the Photo clicked is clear and has a well lit background"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": []
           }
         }
       }
     }
   },
   "Deliver": {
     "$val": {
       "items": {
         "$expr": "$.inputs.items"
       },
       "title": {
         "$expr": "$.inputs.deliverTitle",
         "$val": "Complete Delivery"
       },
       "message": {
         "$expr": "$.inputs.deliverMessage",
         "$val": "Confirm Delivery of, "
       },
       "confirmCustodyExchange": {
         "$val": false
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": [
               "R-0041",
               "R-0042",
               "R-0043"
             ]
           },
           "E-011": {
             "$val": [
               "R-0027"
             ]
           }
         }
       }
     }
   },
   "ReturnPayment": {
     "$val": {
       "expectedAmount": {
         "$expr": "$.inputs.amount"
       },
       "title": {
         "$expr": "$.inputs.returnPaymentTitle",
         "$val": "Return Cash"
       },
       "message": {
         "$expr": "$.inputs.returnPaymentMessage",
         "$val": "Cash to be returned"
       },
       "confirmCustodyExchange": {
         "$val": false
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": [
               "R-0027"
             ]
           },
           "E-011": {
             "$val": []
           }
         }
       }
     }
   },
   "Form": {
     "$val": {
       "jsonSchema": {
         "$expr": "$.inputs.jsonSchema",
         "$val": {
           "type": {
             "$val": "object"
           },
           "required": {
             "$val": [
               "rescheduleDate"
             ]
           },
           "properties": {
             "$val": {
               "rescheduleDate": {
                 "$val": {
                   "type": {
                     "$val": "string"
                   }
                 }
               }
             }
           }
         }
       },
       "uiSchema": {
         "$expr": "$.inputs.uiSchema",
         "$val": {
           "rescheduleDate": {
             "$val": {
               "ui:widget": {
                 "$val": "datePicker"
               },
               "ui:options": {
                 "$val": {
                   "mode": {
                     "$val": "date"
                   }
                 }
               }
             }
           }
         }
       },
       "title": {
         "$expr": "$.inputs.formTitle",
         "$val": "Reschedule Delivery"
       },
       "message": {
         "$expr": "$.inputs.formMessage",
         "$val": "Please confirm next delivery date"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": []
           }
         }
       }
     }
   },
   "Display": {
     "$val": {
       "displayType": {
         "$val": "MESSAGE"
       },
       "text": {
         "$val": "Decision gateway"
       },
       "title": {
         "$val": "Dummy ET"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": []
           }
         }
       }
     }
   },
   "VerifyLocation": {
     "$val": {
       "geolocation": {
         "$val": {
           "geofencing": {
             "$val": {
               "radius": {
                 "$val": 200
               }
             }
           },
           "latitude": {
             "$expr": "$.inputs.geoLocation.latitude"
           },
           "longitude": {
             "$expr": "$.inputs.geoLocation.longitude"
           }
         }
       },
       "title": {
         "$expr": "$.inputs.verifyLocationTitle",
         "$val": "Verify Location"
       },
       "message": {
         "$expr": "$.inputs.verifyLocationMessage",
         "$val": "Enable location acceess to proceed"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": [
               "R-0022",
               "R-0023",
               "R-0024",
               "R-0025",
               "R-0026",
               "R-0027",
               "R-0028",
               "R-0029"
             ]
           },
           "E-011": {
             "$val": [
               "R-0024",
               "R-0025",
               "R-0026",
               "R-0027"
             ]
           }
         }
       }
     }
   },
   "CollectPayment_InitPayment": {
     "$val": {
       "amount": {
         "$expr": "$.inputs.amount"
       },
       "allowedModes": {
         "$val": [
           "CASH"
         ]
       },
       "title": {
         "$val": "Collect Payment"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": [
               "R-0020"
             ]
           }
         }
       }
     }
   },
   "CollectPayment_ProcessPayment": {
     "$val": {
       "amount": {
         "$expr": "$.inputs.amount"
       },
       "paymentMode": {
         "$val": "CASH"
       },
       "title": {
         "$val": "Processing Payment"
       },
       "transactionId": {
         "$expr": "$.CollectPayment_InitPayment.output.transactionId"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": [
               "R-0020"
             ]
           }
         }
       }
     }
   },
   "CollectPayment_CompletePayment": {
     "$val": {
       "expectedAmount": {
         "$expr": "$.inputs.amount"
       },
       "collectedAmount": {
         "$expr": "$.CollectPayment_ProcessPayment.output.collectedAmount"
       },
       "transactionId": {
         "$expr": "$.CollectPayment_ProcessPayment.output.transactionId"
       },
       "tenantTransactionId": {
         "$expr": "$.CollectPayment_ProcessPayment.output.tenantTransactionId"
       },
       "paymentMode": {
         "$expr": "$.CollectPayment_ProcessPayment.output.paymentMode"
       },
       "title": {
         "$val": "Payment Received"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": [
               "R-0020"
             ]
           }
         }
       }
     }
   },
   "WebCollectPayment_InitPayment": {
     "$val": {
       "amount": {
         "$expr": "$.inputs.amount"
       },
       "allowedModes": {
         "$val": [
           "CASH"
         ]
       },
       "title": {
         "$val": "Collect Payment"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": [
               "R-0020"
             ]
           }
         }
       }
     }
   },
   "WebCollectPayment_ProcessPayment": {
     "$val": {
       "amount": {
         "$expr": "$.inputs.amount"
       },
       "paymentMode": {
         "$val": "CASH"
       },
       "title": {
         "$val": "Processing Payment"
       },
       "transactionId": {
         "$expr": "$.WebCollectPayment_InitPayment.output.transactionId"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": [
               "R-0020"
             ]
           }
         }
       }
     }
   },
   "WebCollectPayment_CompletePayment": {
     "$val": {
       "expectedAmount": {
         "$expr": "$.inputs.amount"
       },
       "collectedAmount": {
         "$expr": "$.WebCollectPayment_ProcessPayment.output.collectedAmount"
       },
       "transactionId": {
         "$expr": "$.WebCollectPayment_ProcessPayment.output.transactionId"
       },
       "tenantTransactionId": {
         "$expr": "$.WebCollectPayment_ProcessPayment.output.tenantTransactionId"
       },
       "paymentMode": {
         "$expr": "$.WebCollectPayment_ProcessPayment.output.paymentMode"
       },
       "title": {
         "$val": "Payment Received"
       },
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": [
               "R-0020"
             ]
           }
         }
       }
     }
   },
   "Start": {
     "$val": {
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": []
           },
           "E-011": {
             "$val": [
               "R-0013",
               "R-0014"
             ]
           }
         }
       }
     }
   },
   "Completed-Success": {
     "$val": {
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": [
               "R-0072"
             ]
           }
         }
       }
     }
   },
   "Completed-Failure": {
     "$val": {
       "applicableReasons": {
         "$val": {
           "E-010": {
             "$val": [
               "R-0073"
             ]
           }
         }
       }
     }
   }
 },
 "conditions": {
   "wfStarted": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0006"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       }
     ]
   },
   "webWfStarted": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0006"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       },
       {
         "==": [
           "$.output.reasonCode",
           "R-0100"
         ]
       }
     ]
   },
   "paymentFailure": {
     "or": [
       {
         "and": [
           {
             "==": [
               "$.output.entityCode",
               "0017"
             ]
           },
           {
             "==": [
               "$.output.eventCode",
               "E-011"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0020"
             ]
           }
         ]
       },
       {
         "and": [
           {
             "==": [
               "$.output.entityCode",
               "0018"
             ]
           },
           {
             "==": [
               "$.output.eventCode",
               "E-011"
             ]
           }
         ]
       },
       {
         "and": [
           {
             "==": [
               "$.output.entityCode",
               "0019"
             ]
           },
           {
             "==": [
               "$.output.eventCode",
               "E-011"
             ]
           }
         ]
       }
     ]
   },
   "paymentSuccess": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0019"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       }
     ]
   },
   "wfFailedVerifyLocation": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0006"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       },
       {
         "==": [
           "$.output.reasonCode",
           "R-0014"
         ]
       }
     ]
   },
   "wfFailedForm": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0006"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       },
       {
         "==": [
           "$.output.reasonCode",
           "R-0013"
         ]
       }
     ]
   },
   "wfFailedDisplay": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0006"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       },
       {
         "==": [
           "$.output.reasonCode",
           "R-0100"
         ]
       }
     ]
   },
   "doodleSuccess": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0014"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       }
     ]
   },
   "doodleFailed": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0014"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       }
     ]
   },
   "captureImageSuccess": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0011"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       }
     ]
   },
   "captureImageFailed": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0011"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       }
     ]
   },
   "deliverSuccess": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0010"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       },
       {
         "or": [
           {
             "==": [
               "$.output.reasonCode",
               "R-0041"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0042"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0043"
             ]
           }
         ]
       }
     ]
   },
   "deliverFailed": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0010"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       },
       {
         "==": [
           "$.output.reasonCode",
           "R-0027"
         ]
       }
     ]
   },
   "dropSuccess": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0022"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       },
       {
         "==": [
           "$.output.reasonCode",
           "R-0027"
         ]
       }
     ]
   },
   "dropFailed": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0022"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       }
     ]
   },
   "formSuccess": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0015"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       }
     ]
   },
   "formFailed": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0015"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       }
     ]
   },
   "displaySuccessRescheduled": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0013"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       },
       {
         "==": [
           "$.output.reasonCode",
           "R-0013"
         ]
       }
     ]
   },
   "displaySuccess": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0013"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       },
       {
         "or": [
           {
             "==": [
               "$.output.reasonCode",
               "R-0022"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0023"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0024"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0025"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0026"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0027"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0028"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0029"
             ]
           }
         ]
       }
     ]
   },
   "verifyLocationSuccess": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0021"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-010"
         ]
       },
       {
         "or": [
           {
             "==": [
               "$.output.reasonCode",
               "R-0022"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0023"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0024"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0025"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0026"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0027"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0028"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0029"
             ]
           }
         ]
       }
     ]
   },
   "verifyLocationFailed": {
     "and": [
       {
         "==": [
           "$.output.entityCode",
           "0021"
         ]
       },
       {
         "==": [
           "$.output.eventCode",
           "E-011"
         ]
       },
       {
         "or": [
           {
             "==": [
               "$.output.reasonCode",
               "R-0024"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0025"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0026"
             ]
           },
           {
             "==": [
               "$.output.reasonCode",
               "R-0027"
             ]
           }
         ]
       }
     ]
   }
 },
 "canMerge": false
}

Execution Workflow Instance

A workflow instance is a workflow ID plus the input data for executing the workflow.

Attributes of an Execution Workflow Instance

The Execution Workflow Instance are categorized as the following:

CategoryAttribute NameData Type ExpectedPurpose
BaseTenant IDUUIDThe ID of the tenant to whom the workflow instance belongs.
BaseWorkflow IDVarCharThis contains the system-generated unique id for the workflow.
BaseInputs
(Optional)
ObjectInput values of the variables used in the workflow.

To create to register an Execution Macro, call the Create instance of a workflow endpoint.

Request bodies are specified in JSON format. The following examples show a request body for creating an instance of a Workflow:

MemberDescriptionValidationData type
workflowWorkflow ID.string
inputsDynamic inputs provided at time of creating workflow instance.object
{
   "workflow": "{{workflowId}}",
   "inputs": {
       "items": [
           {
               "skuId": "id"
           }
       ]
   }
}