State Machine Data Model
Advertencia
Esta página aún no se encuentra traducida al español.
Description
The COTSMStateMachine data model explained below stores a state machine's (workflow's) settings.
State machines, also know as workflows, are definitions of how tasks behave. They define a workflow's initial state, the other states they can change to, what triggers are executed, if reminders are sent, and more.
JSON Sample
{
"__v": 3,
"_id": "6179f1900f434fa685f7a857",
"allowedExtensions": [ //Additional Fields
"6179f1f6bb1f957abdd723b5" //COTPropertyType (Collection)
],
"asset": {
"propertyType": "6179f1d155753e932b4cb08c", //COTProperyType (Collection)
},
"code": "taskmanagerflow_05",
"company": "6179f1ee6ec8b62d2406ec46", //COTCompany
"createdAt": "2021-02-23T11:54:44.287Z",
"dynamicPropertyTypes": { //Additional fields
"status1": "6179f19c0af69ae6681dbba0", //COTPropertyType (Collection)
"status2": "6179f1a2963af3b56fd04d93", //COTPropertyType (Collection)
"status3": "6179f1a963b531035f7e5065", //COTPropertyType (Collection)
"status4": null,
"status5": null,
"isActive": [
"status1",
"status2",
"status3"
]
},
"hooks": {
"onCreate": [] //COTParametrizedBot (Routine)
},
"initialState": "6179f1b9ff2235eb2120565e", //COTSMState
"isActive": true,
"taskGroup": "6179f1b04f04ff1c7f7cf01a", //COTTaskGroup (Workflow Group)
"name": "Task Manager Flow",
"propertyType": "6179f1cb4f1389218162fe05", //COTPropertyType (States' Collection)
"requiredSurvey": { //Workflow Start Form
"surveyId": "6179f1df620c1bc7c7865862", //COTSurvey
"permissions": null,
"parametrizedBot": [] //COTPrametrizedBot (Routine)
}
}
Field | Description | Type | Note |
---|---|---|---|
allowedExtensions | An array of collections used as additional fields for the workflow. | ObjectId<COTPropertyType>[ ] | The additional fields created by these collections are similar to the additional fields created by the collections in the dynamicPropertyTypes field. But the later should be preferred. See "Best Practices" for more information. |
asset | Indicates the asset used to represent the tasks created through the workflow (state machine). | object | |
asset.propertyType | The collection (property type) associated with the asset. The indicated collection can store relavant task data. | ObjectId<COTPropertyType> | Furthermore, the collection's additional fields are shared with all the tasks beloning to the task group. |
code | The state machine's unique identification name. | string | Maximum 60 characters; only lowercase letters, numbers, and underscore allowed; must be unique. |
company | Indicates the company the survey is found in. | ObjectId<COTCompany> | |
createdAt | Date the workflow was created. | ISODate | YYYY-MM-DDTHH:mm:ss.SSSZ |
dynamicPropertyTypes | Indicates the collections (property types) set as statuses in the additional fields section of workflow settings. Users will be able to select elements from the collections to give further details about the task. | object | This option can be used to filter tasks, establish permissions, set priorities, among others. |
dynamicPropertyTypes .isActive | Lists the statuses associated with a collection (property type). | string[ ] | Enum: [ "status1", "status2", "status3", "status4", "status5"] |
dynamicPropertyTypes .status1 | Collection used as an additional field. | ObjectId<COTPropertyType> | |
dynamicPropertyTypes .status2 | Collection used as an additional field. | ObjectId<COTPropertyType> | |
dynamicPropertyTypes .status3 | Collection used as an additional field. | ObjectId<COTPropertyType> | |
dynamicPropertyTypes .status4 | Collection used as an additional field. | ObjectId<COTPropertyType> | |
dynamicPropertyTypes .status5 | Collection used as an additional field. | ObjectId<COTPropertyType> | |
hooks | Used for running routines triggered by an event. | object | |
hooks.onCreate | Routine that runs on the creation of a task. | COTParametrizedBot[ ] | |
initialState | Indicates the state the workflow begins in. | ObjectId<COTSMState> | |
isActive | Indicates whether the workflow is active or not. | boolean | |
modifiedAt | Indicates the last time the workflow was modified. | ISODate | YYYY-MM-DDTHH:mm:ss.SSSZ |
name | The workflow's display name | string | |
propertyType | Indicates the collection (property type) that contains the elements that represent the workflow's states. | ObjectId<COTPropertyType> | |
requiredSurvey | Represents a start form, used for initializing a workflow. | object | |
requiredSurvey .parametrizedBot | Configuration of the routine that accompanies the start form. | COTParametrizedBot[ ] | |
requiredSurvey .permissions | List of start form permissions users need to initiate the workflow. | string[ ] | Users need at least one of the permissions listed. Users are designated permissions through their access roles. |
requiredSurvey .surveyId | Workflow start form ID | ObjectId<COTSurvey> | |
taskGroup | The workflow group thats hosts all the tasks created upon the workflow. | ObjectId<COTTaskGroup> |
Deprecated
Field | Description | Type | Note |
---|---|---|---|
asset.property | The asset's property (element) ID. | ObjectId<COTProperty> | DEPRECATED |
asset.type | Use the generic type for tasks that need to be repeated. Use unique for one-time tasks. | string | DEPRECATED |
taskChannelType | Refers to the relationship task's and their channels. Enum: ["bound", "unbound", "unbound-hierarchy"] SHOULD ALWAYS BE ON BOUND | string | DEPRECATED. |
Additional Resources
- Workflow Configuration: Worflow configurations through the Administrative Panel
- Create Workflow Tutorial: Basic tutorial on how to create a workflow
- "State Machines" REST API documentation: basic "State Machines" API requests
- API documentation in Swagger: complete with data models (schemas)
- COTLang: use COTLang for extracting data from models in routines
- Triggers and Contexts: more information on using data models within routines
Help
- Cotalker Platform Community: post your questions or search for previous answers given in the forum