A workflow can be of be a type of instance or template. A workflow without a business defined is referred to as a template (link)
Retrieve a list of Templates.
const templates = await Xedi.Templates.list();
[{"_id": "c490e097-b232-4ee7-8958-2310a6060063","name": "template name (order)","is_template": 1,"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922","connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71","document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09","owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351","created_at": "2020-05-11 10:27:03","updated_at": "2020-05-11 10:27:03"},{"_id": "e997904e-6a3b-40db-b1e0-19c13b541ed7","name": "template name (invoice)","is_template": 1,"creator_id": "33e887f0-1709-4475-b78d-95bae3ac0349","connection_id": "2ece6a69-8d57-4f77-9e3e-55a017ba66b0","document_group_id" : "42c30ce2-1463-4877-b8a4-9d9b6e294859","owner_id": "ab994a41-db9d-4583-8b80-080029c0c569","created_at": "2020-05-11 10:27:03","updated_at": "2020-05-11 10:27:03"}]
Retrieve a template by Id.
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
const template = await Xedi.Templates.get('c490e097-b232-4ee7-8958-2310a6060063');
{"_id": "c490e097-b232-4ee7-8958-2310a6060063","name": "template name (order)","is_template": 1,"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922","connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71","document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09","owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351","created_at": "2020-05-11 10:27:03","updated_at": "2020-05-11 10:27:03"}
Create a new template
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
name | string | 'template name (order)' | |
is_template | boolean | true | |
creator_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
connection_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
document_group_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
owner_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
const template = await Xedi.Templates.create({"name": "template name (order)","is_template": 1,"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922","connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71","document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09","owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",});
{"_id": "c490e097-b232-4ee7-8958-2310a6060063","name": "template name (order)","is_template": 1,"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922","connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71","document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09","owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351","created_at": "2020-05-11 10:27:03","updated_at": "2020-05-11 10:27:03"}
Update an existing Template.
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
name | string | 'template name (order)' | |
is_template | boolean | true | |
creator_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
connection_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
document_group_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
owner_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
const template = await Xedi.Templates.update({"_id": "c490e097-b232-4ee7-8958-2310a6060063","name": "template name (order) v2","is_template": 1,"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922","connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71","document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09","owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",});
{"_id": "c490e097-b232-4ee7-8958-2310a6060063","name": "template name (order) v2","is_template": 1,"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922","connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71","document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09","owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351","created_at": "2020-05-11 10:27:03","updated_at": "2020-05-11 10:27:03"}
Delete a Template. Response contains a deleted_at flag which signifies it has been deleted.
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
const template = await Xedi.Templates.delete('c490e097-b232-4ee7-8958-2310a6060063');
{"_id": "c490e097-b232-4ee7-8958-2310a6060063"}
Restore will reinstate a deleted template.
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
const template = await Xedi.Templates.restore('c490e097-b232-4ee7-8958-2310a6060063');
{"_id": "c490e097-b232-4ee7-8958-2310a6060063","name": "template name (order) v2","is_template": 1,"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922","connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71","document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09","owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351","created_at": "2020-05-11 10:27:03","updated_at": "2020-05-11 10:27:03"}