Hi,
I’d like a workflows to calculate a target date from the raised date, instead of when the workflow triggers. I have tried the method below
{
"ancestorId": "651ac8c22d125523eb7dc91d",
"signature": "651aede5d9015982931c52bf",
"parameters": [
{
"discriminator": "WorkflowComputedItemAttributeWebModel",
"attributeCode": "attributes_tasksTargetTime",
"value": {
"discriminator": "WorkflowSyntaxNodeScriptWebModel",
"script": "return raiseddatetime.AddDays(14);",
"returnOptions": null
}
}
],
"variables": [
{
"name": "raiseddatetime",
"value": {
"discriminator": "WorkflowSyntaxNodeInputWebModel",
"inputParent": 1,
"itemValue": {
"discriminator": "WorkflowSyntaxArgumentItemValueAttributeWebModel",
"attributeCode": "attributes_tasksRaisedTime"
}
}
}
],
"actionDesignCode": "designs_workflowEditItemAction"
}
But receive the following error:
"message": "Action failed",
"error": {
"category": "WorkflowScriptCompilationFailed",
"errorCode": "E1648733619",
"errorData": {
"causes": [
{
"message": "AlloyBadRequestException: WorkflowScriptCompilationFailed: E1590072575: Script sandbox failed to compile",
"errorData": {
"errors": [
{
"failedCode": "AddDays",
"location": {
"start": 211,
"end": 218,
"length": 7,
"isEmpty": false
},
"error": "'DateTime?' does not contain a definition for 'AddDays' and no accessible extension method 'AddDays' accepting a first argument of type 'DateTime?' could be found (are you missing a using directive or an assembly reference?)",
"errorId": "CS1061"
}
]
}
}
]
},
"httpStatusCode": 400,
"message": "AlloyBadRequestException: WorkflowScriptCompilationFailed: E1590072575: Script sandbox failed to compile\nAlloyException received from RPC call"
},
Are there any helper functions available to calculate datetime differences?