Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tracktor_order_automatically_update_status template #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Setup
* Add one or more custom statuses in your [Tracktor Dashboard](https://poulet-sauvage.myshopify.com/admin/apps/tracktor-dev)
* Edit the Update Manual Status steps in the Automation so the statuses match what you added in Tracktor

## Optional Customizations
* If you want to add a third custom status, add a new Step, select Tracktor > Order > Update Custom Status and make the status value match a custom status entered in Tracktor
146 changes: 146 additions & 0 deletions tracktor/order/tracktor_order_automatically_update_status/mesa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"key": "tracktor_order_automatically_update_status",
"name": "Automatically Update Tracktor Order Status",
"version": "1.0.0",
"description": "Progresses the Tracktor custom order status after one day to the first step in manufacturing, and after a subsequent day to the next step.",
"video": "",
"readme": "",
"tags": [],
"source": "tracktor",
"destination": "tracktor",
"enabled": false,
"logging": false,
"debug": false,
"config": {
"inputs": [
{
"trigger_type": "input",
"type": "tracktor",
"entity": "order",
"action": "order\/all",
"name": "Tracktor Order Status Any Update",
"key": "tracktor_order",
"metadata": [],
"local_fields": null,
"weight": 0
}
],
"outputs": [
{
"trigger_type": "output",
"type": "delay",
"entity": "",
"action": "",
"name": "Delay ",
"key": "delay",
"metadata": {
"amount": "1",
"unit": "days",
"test_bypass": false
},
"local_fields": null,
"weight": 0
},
{
"trigger_type": "output",
"type": "transform",
"entity": "mapping",
"action": null,
"name": "Mapping to Tracktor Status",
"key": "transformmapping",
"metadata": {
"script": "transform_js.js",
"mapping": [
{
"destination": "status",
"source": "Cutting"
},
{
"destination": "automatic_carrier_updates",
"source": "false"
},
{
"destination": "force",
"source": "true"
}
]
},
"local_fields": [
{
"key": "mapping",
"type": "mapping",
"tokens": "brackets"
}
],
"weight": 1
},
{
"trigger_type": "output",
"type": "tracktor",
"entity": "order",
"action": "update",
"name": "Tracktor Update Manual Status Order",
"key": "tracktor_order_1",
"metadata": {
"order_id": "{{delay.order_id}}"
},
"local_fields": null,
"weight": 2
},
{
"trigger_type": "output",
"type": "delay",
"entity": "",
"action": "",
"name": "Delay ",
"key": "delay_1",
"metadata": {
"amount": "1",
"unit": "days",
"test_bypass": false
},
"local_fields": null,
"weight": 3
},
{
"trigger_type": "output",
"type": "transform",
"entity": "",
"action": "",
"name": "Mapping to Tracktor Status",
"key": "tracktor_order_2_transform",
"metadata": {
"script": "tracktor_order_2_transform_js.js",
"mapping": [
{
"destination": "status",
"source": "Sewing"
}
]
},
"local_fields": [
{
"key": "mapping",
"type": "mapping",
"tokens": "brackets"
}
],
"weight": 4
},
{
"trigger_type": "output",
"type": "tracktor",
"entity": "order",
"action": "update",
"name": "Tracktor Update Manual Status Order",
"key": "tracktor_order_2",
"metadata": {
"order_id": "{{delay.order_id}}"
},
"local_fields": null,
"weight": 5
}
],
"storage": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const Mesa = require('vendor/Mesa.js');
const Transform = require('vendor/Transform.js');

/**
* A Mesa Script exports a class with a script() method.
*/
module.exports = new class {

/**
* Mesa Script
*
* @param {object} payload The payload data
* @param {object} context Additional context about this task
*/
script = (payload, context) => {

// Adjust `payload` here to alter data before we transform it.

// Alter the payload data based on our transform rules
const output = Transform.convert(context, payload);

// Adjust `output` here to alter data after we transform it.

// We're done, call the next step!
Mesa.output.next(output);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const Mesa = require('vendor/Mesa.js');
const Transform = require('vendor/Transform.js');

/**
* A Mesa Script exports a class with a script() method.
*/
module.exports = new class {

/**
* Mesa Script
*
* @param {object} payload The payload data
* @param {object} context Additional context about this task
*/
script = (payload, context) => {

// Adjust `payload` here to alter data before we transform it.

// Alter the payload data based on our transform rules
const output = Transform.convert(context, payload);

// Adjust `output` here to alter data after we transform it.

// We're done, call the next step!
Mesa.output.next(output);
}
}