Skip to main content

CPA Payment Claim Processing

This workflow is included in the Contracts module.

Description​

Creates job work item claims from CPA payment claim data passed as JSON.

Properties​

This workflow has the following properties.

PropertyValue
NameCPA Payment Claim Processing
Codeworkflows_cpaPaymentClaimProcessing
TypeWorkflow
ContextModule
EnabledYes

Trigger​

A user triggers this workflow on demand, or another workflow runs it (via an MWR). It works on the items of the design below.

PropertyValue
Workflow typeManual workflow
Applies toJobs With Claims
Output modeManyItems  (Runs once for all items)
Parameters designMTP CPA Payment Claim
Output actionThe Output action highlighted in the diagram below

Actions​

This workflow runs 9 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 (592 lines)
{
"trigger": {
"dodiCode": "designInterfaces_jobsWithClaims",
"outputMode": "ManyItems",
"parametersDesignCode": "designs_MTPCpaPaymentClaim",
"outputActionId": "685ad340de0bf8df53a01520"
},
"actions": [
{
"actionId": "685ad340de0bf8df53a01520",
"designCode": "designs_workflowOutputAction",
"description": "Expand claim lines with JWI item id",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionData",
"value": {
"script": "var data=claimData;return Json(new{items=data[\"lines\"].Children().Where(line=>line[\"workItemId\"]!=null&&(string)line[\"workItemId\"]!=\"\").Select(line=>new{attributes_cpaClaimWorkflowDataPaymentRequestId=(string)data[\"claimReference\"],attributes_cpaClaimWorkflowDataClaimQuantity=(double)line[\"quantity\"],attributes_cpaClaimWorkflowDataClaimRate=(double)line[\"rate\"],attributes_cpaClaimWorkflowDataClaimValue=(double)line[\"value\"],attributes_cpaClaimWorkflowDataClaimDate=(DateTime)data[\"claimDate\"],attributes_cpaClaimWorkflowDataComments=(string)line[\"tracksheetRef\"],attributes_cpaClaimWorkflowDataSorCode=\"__NONE__\",attributes_cpaClaimWorkflowDataWorkItemId=(string)line[\"workItemId\"]}).ToArray()});"
},
"attributeType": "Json"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designs_cpaClaimWorkflowData",
"attributeType": "String"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false,
"attributeType": "Boolean"
}
}
],
"variables": [
{
"name": "claimData",
"value": {
"parameterCode": "attributes_MTPCpaPaymentClaimData",
"inputMode": "Each"
}
}
],
"actions": [
{
"actionId": "685ad340de0bf8df53a01525",
"designCode": "designs_workflowCreateItemAction",
"description": "Create Job Work Item Claim under existing JWI",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsDesignCode",
"attributeType": "String",
"value": "designs_jobWorkItemClaims"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsCollection",
"attributeType": "String",
"value": "Live"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsSingleInstance",
"attributeType": "Boolean",
"value": false
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsParentsLinkAttributeCode",
"attributeType": "String",
"value": "attributes_jobWorkItemsWithClaimsJobWorkItemClaims"
}
},
{
"attributeCode": "attributes_workflowCreateItemActionsParents",
"attributeType": "Link",
"value": {
"script": "return Set(AlloyId(workItemId));",
"returnOptions": {
"code": "designInterfaces_jobWorkItemsWithClaims",
"graph": "Lookup",
"weakReference": true,
"max": 1
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsPaymentRequestId",
"attributeType": "String",
"value": {
"outputAction": "685ad340de0bf8df53a01520",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataPaymentRequestId"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsClaimQuantity",
"attributeType": "Number",
"value": {
"outputAction": "685ad340de0bf8df53a01520",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimQuantity"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsClaimRate",
"attributeType": "Number",
"value": {
"outputAction": "685ad340de0bf8df53a01520",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimRate"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsClaimValue",
"attributeType": "Number",
"value": {
"outputAction": "685ad340de0bf8df53a01520",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimValue"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsClaimDate",
"attributeType": "DateTime",
"value": {
"outputAction": "685ad340de0bf8df53a01520",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimDate"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsComments",
"attributeType": "String",
"value": {
"outputAction": "685ad340de0bf8df53a01520",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataComments"
}
}
}
],
"variables": [
{
"name": "workItemId",
"value": {
"outputAction": "685ad340de0bf8df53a01520",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataWorkItemId"
}
}
}
],
"actions": []
}
]
},
{
"actionId": "685ad340de0bf8df53a01544",
"designCode": "designs_workflowOutputAction",
"description": "Expand claim lines without JWI item id",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionData",
"value": {
"script": "var data=claimData;return Json(new{items=data[\"lines\"].Children().Where(line=>line[\"workItemId\"]==null||(string)line[\"workItemId\"]==\"\").Select(line=>new{attributes_cpaClaimWorkflowDataPaymentRequestId=(string)data[\"claimReference\"],attributes_cpaClaimWorkflowDataClaimQuantity=(double)line[\"quantity\"],attributes_cpaClaimWorkflowDataClaimRate=(double)line[\"rate\"],attributes_cpaClaimWorkflowDataClaimValue=(double)line[\"value\"],attributes_cpaClaimWorkflowDataClaimDate=(DateTime)data[\"claimDate\"],attributes_cpaClaimWorkflowDataComments=(string)line[\"tracksheetRef\"],attributes_cpaClaimWorkflowDataSorCode=(string)line[\"sorCode\"],attributes_cpaClaimWorkflowDataWorkItemId=\"000000000000000000000000\"}).ToArray()});"
},
"attributeType": "Json"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designs_cpaClaimWorkflowData",
"attributeType": "String"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false,
"attributeType": "Boolean"
}
}
],
"variables": [
{
"name": "claimData",
"value": {
"parameterCode": "attributes_MTPCpaPaymentClaimData",
"inputMode": "Each"
}
}
],
"actions": [
{
"actionId": "685ad340de0bf8df53a01522",
"designCode": "designs_workflowCreateItemAction",
"description": "Create Job Work Item under the Job",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsDesignCode",
"attributeType": "String",
"value": "designs_measurementJobWorkItems"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsCollection",
"attributeType": "String",
"value": "Live"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsSingleInstance",
"attributeType": "Boolean",
"value": false
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsParentsLinkAttributeCode",
"attributeType": "String",
"value": "attributes_jobsJobWorkItems"
}
},
{
"attributeCode": "attributes_workflowCreateItemActionsParents",
"attributeType": "Link",
"value": {
"inputParent": 1,
"itemValue": {
"property": "ItemId"
}
}
},
{
"attributeCode": "attributes_jobWorkItemsWorkItem",
"attributeType": "Link",
"value": {
"outputAction": "685ad340de0bf8df53a01521",
"outputMode": "Input",
"itemValue": {
"property": "ItemId"
}
}
},
{
"attributeCode": "attributes_jobWorkItemsActualValue",
"attributeType": "Number",
"value": {
"outputAction": "685ad340de0bf8df53a01544",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimQuantity"
}
}
}
],
"variables": [],
"actions": [
{
"actionId": "685ad340de0bf8df53a01523",
"designCode": "designs_workflowCreateItemAction",
"description": "Create Job Work Item Claim",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsDesignCode",
"attributeType": "String",
"value": "designs_jobWorkItemClaims"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsCollection",
"attributeType": "String",
"value": "Live"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsSingleInstance",
"attributeType": "Boolean",
"value": false
}
},
{
"attribute": {
"attributeCode": "attributes_workflowCreateItemActionsParentsLinkAttributeCode",
"attributeType": "String",
"value": "attributes_jobWorkItemsWithClaimsJobWorkItemClaims"
}
},
{
"attributeCode": "attributes_workflowCreateItemActionsParents",
"attributeType": "Link",
"value": {
"inputParent": 0,
"itemValue": {
"property": "ItemId"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsPaymentRequestId",
"attributeType": "String",
"value": {
"outputAction": "685ad340de0bf8df53a01544",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataPaymentRequestId"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsClaimQuantity",
"attributeType": "Number",
"value": {
"outputAction": "685ad340de0bf8df53a01544",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimQuantity"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsClaimRate",
"attributeType": "Number",
"value": {
"outputAction": "685ad340de0bf8df53a01544",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimRate"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsClaimValue",
"attributeType": "Number",
"value": {
"outputAction": "685ad340de0bf8df53a01544",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimValue"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsClaimDate",
"attributeType": "DateTime",
"value": {
"outputAction": "685ad340de0bf8df53a01544",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataClaimDate"
}
}
},
{
"attributeCode": "attributes_jobWorkItemClaimsComments",
"attributeType": "String",
"value": {
"outputAction": "685ad340de0bf8df53a01544",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataComments"
}
}
}
],
"variables": [],
"actions": []
}
]
},
{
"actionId": "685ad340de0bf8df53a01521",
"designCode": "designs_workflowQueryAction",
"description": "Find work item by SOR code",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowQueryActionsAqsQuery",
"value": {
"type": "Query",
"properties": {
"collectionCode": "Live",
"dodiCode": "designs_measurementWorkItems",
"parameters": [
{
"name": "sorCode",
"type": "String",
"defaultValue": "",
"title": "SOR Code"
}
]
},
"children": [
{
"type": "Equals",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_workItemsCode"
}
},
{
"type": "String",
"properties": {
"parameterName": "sorCode"
}
}
]
}
]
}
}
}
],
"variables": [
{
"name": "sorCode",
"value": {
"outputAction": "685ad340de0bf8df53a01544",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimWorkflowDataSorCode"
}
}
}
],
"actions": []
}
]
},
{
"actionId": "685ad340de0bf8df53a01540",
"designCode": "designs_workflowOutputAction",
"description": "Group claim lines by JWI and sum quantities",
"parameters": [
{
"attributeCode": "attributes_workflowOutputActionData",
"value": {
"script": "var data=claimData;var grouped=data[\"lines\"].Children().Where(line=>line[\"workItemId\"]!=null&&(string)line[\"workItemId\"]!=\"\").GroupBy(line=>(string)line[\"workItemId\"]).Select(g=>new{attributes_cpaClaimGroupedByJwiWorkItemId=g.Key,attributes_cpaClaimGroupedByJwiSummedQuantity=g.Sum(line=>(double)line[\"quantity\"])}).ToArray();return Json(new{items=grouped});"
},
"attributeType": "Json"
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionDodiCode",
"value": "designs_cpaClaimGroupedByJwi",
"attributeType": "String"
}
},
{
"attribute": {
"attributeCode": "attributes_workflowOutputActionSingleInstance",
"value": false,
"attributeType": "Boolean"
}
}
],
"variables": [
{
"name": "claimData",
"value": {
"parameterCode": "attributes_MTPCpaPaymentClaimData",
"inputMode": "Each"
}
}
],
"actions": [
{
"actionId": "685ad340de0bf8df53a01541",
"designCode": "designs_workflowQueryAction",
"description": "Find JWI by grouped work item ID",
"parameters": [
{
"attribute": {
"attributeCode": "attributes_workflowQueryActionsAqsQuery",
"value": {
"type": "Query",
"properties": {
"collectionCode": "Live",
"dodiCode": "designInterfaces_jobWorkItems",
"parameters": [
{
"name": "workItemId",
"type": "AlloyId",
"defaultValue": [],
"title": "Work Item ID"
}
]
},
"children": [
{
"type": "Equals",
"children": [
{
"type": "ItemProperty",
"properties": {
"itemPropertyName": "ItemId"
}
},
{
"type": "AlloyId",
"properties": {
"parameterName": "workItemId"
}
}
]
}
]
}
}
}
],
"variables": [
{
"name": "workItemId",
"value": {
"outputAction": "685ad340de0bf8df53a01540",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimGroupedByJwiWorkItemId"
}
}
}
],
"actions": [
{
"actionId": "685ad340de0bf8df53a01542",
"designCode": "designs_workflowEditItemAction",
"description": "Add grouped summed quantity to JWI actual value",
"parameters": [
{
"attributeCode": "attributes_jobWorkItemsActualValue",
"attributeType": "Number",
"value": {
"script": "return (currentActualValue??0.0)+summedQuantity;"
}
}
],
"variables": [
{
"name": "currentActualValue",
"value": {
"inputParent": 0,
"itemValue": {
"attributeCode": "attributes_jobWorkItemsActualValue"
}
}
},
{
"name": "summedQuantity",
"value": {
"outputAction": "685ad340de0bf8df53a01540",
"outputMode": "Input",
"itemValue": {
"attributeCode": "attributes_cpaClaimGroupedByJwiSummedQuantity"
}
}
}
],
"actions": []
}
]
}
]
}
]
}