Skip to main content

Create Supplier Invoice

This workflow is included in the Bulk Account Invoicing module.

Description​

This workflow has no description.

Properties​

This workflow has the following properties.

PropertyValue
NameCreate Supplier Invoice
Codeworkflows_createSupplierInvoice
TypeWorkflow
ContextModule
EnabledYes

Trigger​

A user triggers this workflow on demand. It works on the items of the design below.

PropertyValue
Workflow typeManual workflow
Applies toSupplier Accounts
Output modeOneItem  (Runs once per item)

Actions​

This workflow runs 5 actions, in the order shown in this simplified diagram. Every action's full settings are in the configuration below.

Configuration​

The full configuration of this workflow, including every action's parameters.

Show configuration (505 lines)
{
"trigger": {
"dodiCode": "designs_supplierAccounts",
"outputMode": "OneItem"
},
"actions": [
{
"description": "Get Ready-to-Invoice JWIs",
"designCode": "designs_workflowQueryAction",
"actionId": "6287c35a76848541ac2b882f",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowQueryActionsAqsQuery",
"value": {
"type": "Query",
"properties": {
"collectionCode": "Live",
"dodiCode": "designInterfaces_jobWorkItems",
"parameters": [
{
"name": "supplierAccount",
"type": "AlloyId",
"defaultValue": [],
"title": "Supplier Account",
"dodiCode": "designs_supplierAccounts"
}
]
},
"children": [
{
"type": "And",
"children": [
{
"type": "Equals",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_assignedSupplierAccountsSupplierAccount",
"path": "root^attributes_jobsJobWorkItems.attributes_tasksTeam"
}
},
{
"type": "AlloyId",
"properties": {
"parameterName": "supplierAccount"
}
}
]
},
{
"type": "Equals",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_jobWorkUnitInvoicingInvoicing"
}
},
{
"type": "AlloyId",
"properties": {
"value": [
"5f3256da1b5ad5367054c497"
]
}
}
]
},
{
"type": "NotConnectedTo",
"children": [
{
"type": "Item",
"properties": {
"path": "root^attributes_jobWorkUnitInvoiceLinesJobWorkUnit"
}
}
]
}
]
}
]
}
}
}
],
"variables": [
{
"name": "supplierAccount",
"value": {
"inputParent": 0,
"itemValue": {
"property": "ItemId"
}
}
}
],
"actions": [
{
"description": "Create JWU Invoice Lines",
"designCode": "designs_workflowCreateItemAction",
"actionId": "6287c3794abb64c86719b8c6",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsDesignCode",
"attributeType": "String",
"value": "designs_jobWorkUnitInvoiceLines"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsCollection",
"attributeType": "String",
"value": "Live"
}
},
{
"attributeCode": "attributes_jobWorkUnitInvoiceLinesJobWorkUnit",
"attributeType": "Link",
"value": {
"inputParent": 0,
"itemValue": {
"property": "ItemId"
}
}
},
{
"attributeCode": "attributes_accountInvoiceLinesDescription",
"attributeType": "String",
"value": {
"inputParent": 0,
"itemValue": {
"variableName": "description"
}
}
},
{
"attributeCode": "attributes_accountInvoiceLinesSubTotal",
"attributeType": "Number",
"value": {
"script": "return subtotal != null ? subtotal : 0;"
}
},
{
"attributeCode": "attributes_accountInvoiceLinesTax",
"attributeType": "Number",
"value": {
"inputParent": 0,
"itemValue": {
"variableName": "taxAmount"
}
}
},
{
"attributeCode": "attributes_accountInvoiceLinesTotal",
"attributeType": "Number",
"value": {
"script": "return taxAmount + subtotal;"
}
},
{
"attributeCode": "attributes_accountInvoiceLinesTaxRate",
"attributeType": "Link",
"value": {
"aqs": {
"type": "Query",
"properties": {
"dodiCode": "designs_taxRates",
"collectionCode": [
"Live"
],
"parameters": [
{
"name": "jobWorkUnitItemId",
"type": "AlloyId"
}
]
},
"children": [
{
"type": "Equals",
"children": [
{
"type": "ItemProperty",
"properties": {
"itemPropertyName": "itemId",
"path": "root^attributes_workUnitPricingTaxRate^attributes_jobWorkItemsWorkItem"
}
},
{
"type": "AlloyId",
"properties": {
"parameterName": "jobWorkUnitItemId"
}
}
]
}
]
}
}
}
],
"variables": [
{
"name": "jobWorkUnitItemId",
"value": {
"inputParent": 0,
"itemValue": {
"property": "ItemId"
}
}
},
{
"name": "taxRate",
"value": {
"aqs": {
"type": "StatisticsAggregation",
"properties": {
"aggregationType": "Sum",
"dodiCode": "designs_taxRates",
"collectionCode": [
"Live"
],
"attributeCode": "attributes_taxRatesRate",
"parameters": [
{
"name": "jobWorkUnitItemId",
"type": "AlloyId"
}
]
},
"children": [
{
"type": "Equals",
"children": [
{
"type": "ItemProperty",
"properties": {
"itemPropertyName": "itemId",
"path": "root^attributes_workUnitPricingTaxRate^attributes_jobWorkItemsWorkItem"
}
},
{
"type": "AlloyId",
"properties": {
"parameterName": "jobWorkUnitItemId"
}
}
]
}
]
}
}
},
{
"name": "estimatedCost",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_jobWorkItemsEstimatedCost"
}
}
},
{
"name": "actualCost",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_jobWorkItemsActualCost"
}
}
},
{
"name": "actualDescription",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_itemsTitle"
}
}
},
{
"name": "estimatedDescription",
"value": {
"template": "$actualDescription (E)"
}
},
{
"name": "isEstimated",
"value": {
"script": "return actualCost == null;"
}
},
{
"name": "subtotal",
"value": {
"script": "return isEstimated == true ? estimatedCost : actualCost;"
}
},
{
"name": "taxAmount",
"value": {
"script": "return taxRate != null ? (taxRate * subtotal)/100.0 : 0.0;"
}
},
{
"name": "description",
"value": {
"script": "return isEstimated == true ? estimatedDescription : actualDescription;"
}
}
],
"actions": [
{
"description": "Stop if no Invoice Lines",
"designCode": "designs_workflowStopAction",
"actionId": "631b4e2901c6d5d4e424ee60",
"parameters": [
{
"attributeCode": "attributes_workflowStopActionStop",
"attributeType": "Boolean",
"value": {
"script": "return invoiceLineCount == 0;"
}
}
],
"variables": [
{
"name": "invoiceLines",
"value": {
"outputAction": "6287c3794abb64c86719b8c6",
"itemValue": {
"property": "ItemId"
}
}
},
{
"name": "invoiceLineCount",
"value": {
"script": "return invoiceLines != null ? invoiceLines.Count() : 0;"
}
}
],
"actions": [
{
"description": "Create Supplier Invoice",
"designCode": "designs_workflowCreateItemAction",
"actionId": "6287c3919838d85195923100",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsDesignCode",
"attributeType": "String",
"value": "designs_accountInvoices"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsCollection",
"attributeType": "String",
"value": "Live"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsSingleInstance",
"attributeType": "Boolean",
"value": true
}
},
{
"attribute": {
"attributeCode": "attributes_accountInvoicesNumber",
"attributeType": "String",
"value": "Temp"
}
},
{
"attribute": {
"attributeCode": "attributes_accountInvoicesStatus",
"attributeType": "Link",
"value": [
"5ea4354b82c0a85a04be4944"
]
}
},
{
"attributeCode": "attributes_accountInvoicesInvoiceLines",
"attributeType": "Link",
"value": {
"outputAction": "6287c3794abb64c86719b8c6",
"itemValue": {
"property": "ItemId"
}
}
},
{
"attributeCode": "attributes_accountTransactionsDate",
"attributeType": "Date",
"value": {
"offsetMilliseconds": 0,
"offsetOrigin": "Triggered"
}
},
{
"attributeCode": "attributes_accountInvoicesSubTotal",
"attributeType": "Number",
"value": {
"script": "return Variables.invoiceLinesSubtotal.AllValues.Values.Sum(x => x.SingleValue);"
}
},
{
"attributeCode": "attributes_accountInvoicesTax",
"attributeType": "Number",
"value": {
"script": "return Variables.invoiceLinesTax.AllValues.Values.Sum(x => x.SingleValue);"
}
},
{
"attributeCode": "attributes_accountTransactionsAmount",
"attributeType": "Number",
"value": {
"script": "return Variables.invoiceLinesSubtotal.AllValues.Values.Sum(x => x.SingleValue) + Variables.invoiceLinesTax.AllValues.Values.Sum(x => x.SingleValue);"
}
},
{
"attributeCode": "attributes_accountTransactionsAccount",
"attributeType": "Link",
"value": {
"outputAction": "6287c35a76848541ac2b882f",
"itemValue": {
"variableName": "supplierAccount"
}
}
}
],
"variables": [
{
"name": "invoiceLinesSubtotal",
"value": {
"outputAction": "6287c3794abb64c86719b8c6",
"itemValue": {
"attributeCode": "attributes_accountInvoiceLinesSubTotal"
}
}
},
{
"name": "invoiceLinesTax",
"value": {
"outputAction": "6287c3794abb64c86719b8c6",
"itemValue": {
"attributeCode": "attributes_accountInvoiceLinesTax"
}
}
}
],
"actions": [
{
"description": "Update Invoice with Batch Number",
"designCode": "designs_workflowEditItemAction",
"actionId": "6287c3b934e422c58137b35e",
"parameters": [
{
"attributeCode": "attributes_accountInvoicesNumber",
"attributeType": "String",
"value": {
"template": "$batchInvoicePrefix$batchInvoiceNumber"
}
}
],
"variables": [
{
"name": "batchInvoicePrefix",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_bulkAccountInvoicingBulkInvoicingPrefix"
}
}
},
{
"name": "batchInvoiceNumber",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_bulkAccountInvoicingBulkInvoicingNumber"
}
}
}
],
"actions": []
}
]
}
]
}
]
}
]
}
]
}