Terminate action didn't short circuit run execution
- Dominant language
- ABAP
- Stars
- 424
- Forks
- 320
- Avg merge
- 14h 41m
- Merged PRs (30d)
- 1
Description
### Describe the Bug with repro steps
Issue:
Terminate action with condition "Failed", "Skipped" did not short-circuit the run execution, causing an action on the outer scope to execute anyway.
Repro steps:
1. Open Azure Portal
2. Open workflow run history
3. See Terminate action successfully executed
4. See Action on outer scope executed
### What type of Logic App Is this happening in?
Standard (Portal)
### Which operating system are you using?
Windows
### Did you refer to the TSG before filing this issue? [https://aka.ms/lauxtsg]()
Yes
### Workflow JSON
```json
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Initialize_CurrentItem": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "CurrentItem",
"type": "object"
}
]
},
"runAfter": {
"Initialize_Item_Number": [
"SUCCEEDED"
]
}
},
"Initialize_Item_Number": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "ItemNumber",
"type": "integer",
"value": "@int(triggerOutputs()?['headers']?['x-current-item-number'])"
}
]
},
"runAfter": {
"Initialize_TotalNumberOfItems": [
"SUCCEEDED"
]
}
},
"Initialize_TotalNumberOfItems": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "TotalNumberOfItems",
"type": "integer",
"value": "@length(triggerBody()?['items'])"
}
]
},
"runAfter": {
"Initialize_Turbo360BaseHeader": [
"SUCCEEDED"
]
}
},
"Response": {
"type": "Response",
"kind": "Http",
"inputs": {
"statusCode": 202
},
"runAfter": {},
"operationOptions": "Asynchronous"
},
"MainProcess": {
"type": "Scope",
"actions": {
"TotalNumberOfItems_eq_0": {
"type": "If",
"expression": {
"and": [
{
"equals": [
"@variables('TotalNumberOfItems')",
0
]
}
]
},
"actions": {
"Terminate_No_Items": {
"type": "Terminate",
"inputs": {
"runStatus": "Succeeded"
},
"runAfter": {
"CheckPoint_Turbo360_Outbound_Order_No_Items": [
"SUCCEEDED"
]
}
},
"ComposeNoItemsMessage": {
"type": "Compose",
"inputs": "@addProperty(addProperty(variables('Turbo360BaseHeader'),'ErrorMessage','No items present'), 'ErrorCode', 199)"
},
"CheckPoint_Turbo360_Outbound_Order_No_Items": {
"type": "Http",
"inputs": {
"uri": "@parameters('commonParamTurbo360BaseUri')",
"method": "POST",
"headers": {
"Ocp-Apim-Subscription-Key": "@{parameters('commonParamTurbo360SubscriptionId')}",
"Content-Type": "application/json"
},
"body": {
"archiveMessage": false,
"businessProcess": "@{parameters('commonParamTurbo360BusinessProcess')}",
"commandType": "CheckPointWithCorrelation",
"correlationPropertyName": "ActivityId",
"correlationPropertyValue": "@{variables('ActivityId')}",
"isTransactionComplete": true,
"messageHeader": "@{outputs('ComposeNoItemsMessage')}",
"stageName": "@{variables('Turbo360StageName')}",
"stageStatus": "Success",
"transactionName": ""
},
"authentication": {
"type": "ManagedServiceIdentity",
"identity": "@parameters('commonParamIdentityId')",
"audience": "@parameters('commonParamTurbo360Audience')"
}
},
"runAfter": {
"ComposeNoItemsMessage": [
"SUCCEEDED"
]
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
}
},
"else": {
"actions": {
"Set_CurrentItem": {
"type": "SetVariable",
"inputs": {
"name": "CurrentItem",
"value": "@triggerBody()?['items'][sub(variables('ItemNumber'),1)]"
}
},
"ComposeMapInput": {
"type": "Compose",
"inputs": {
"item": "@variables('CurrentItem')",
"items": "@triggerBody()?['items']",
"@{variables('EntityName')}": "@variables('EntityValue')"
},
"runAfter": {
"Set_CurrentItem": [
"SUCCEEDED"
]
}
},
"Transform_JSON_To_JSON": {
"type": "Liquid",
"kind": "JsonToJson",
"inputs": {
"content": "@outputs('ComposeMapInput')",
"map": {
"source": "LogicApp",
"name": "cdm-2-post-storageitem-by-inbound-delivery.liquid"
}
},
"runAfter": {
"ComposeMapInput": [
"SUCCEEDED"
]
}
},
"HTTP_PUT_StorageItem_ByInboundDelivery": {
"type": "Http",
"inputs": {
"uri": "@concat(parameters('commonParamApimBaseUri'),'')",
"method": "PUT",
"headers": {
"Content-Type": "application/json",
"Ocp-Apim-Trace": "true",
"x-turbo360-batchid": "@{variables('BatchId')}",
"x-turbo360-businessidentifier": "@{variables('BusinessIdentifier')}"
},
"body": "@string(body('Transform_JSON_To_JSON'))",
"authentication": {
"audience": "@parameters('commonParamRegAudience')",
"identity": "@parameters('commonParamIdentityId')",
"type": "ManagedServiceIdentity"
}
},
"runAfter": {
"Transform_JSON_To_JSON": [
"SUCCEEDED"
]
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
},
"IsLastItem": {
"type": "If",
"expression": {
"and": [
{
"equals": [
"@variables('TotalNumberOfItems')",
"@variables('ItemNumber')"
]
}
]
},
"actions": {
"CheckPoint_Turbo360_Outbound_Order_Last_Package": {
"type": "Http",
"inputs": {
"uri": "@parameters('commonParamTurbo360BaseUri')",
"method": "POST",
"headers": {
"Ocp-Apim-Subscription-Key": "@{parameters('commonParamTurbo360SubscriptionId')}",
"Content-Type": "application/json"
},
"body": {
"archiveMessage": false,
"businessProcess": "@{parameters('commonParamTurbo360BusinessProcess')}",
"commandType": "CheckPointWithCorrelation",
"correlationPropertyName": "ActivityId",
"correlationPropertyValue": "@{variables('ActivityId')}",
"isTransactionComplete": true,
"messageHeader": "@{outputs('ComposeLastItemMessage')}",
"stageName": "@{variables('Turbo360StageName')}",
"stageStatus": "Success"
},
"authentication": {
"type": "ManagedServiceIdentity",
"identity": "@parameters('commonParamIdentityId')",
"audience": "@parameters('commonParamTurbo360Audience')"
}
},
"runAfter": {
"ComposeLastItemMessage": [
"SUCCEEDED"
]
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
},
"ComposeLastItemMessage": {
"type": "Compose",
"inputs": "@addProperty(addProperty(variables('Turbo360BaseHeader'),'ErrorMessage','Last Item has been processed'), 'ErrorCode', 199)"
}
},
"else": {
"actions": {
"Get_secret": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"referenceName": "keyvault"
}
},
"method": "get",
"path": "/secrets/@{encodeURIComponent('wf-stock-put-storage-item-history-process-v1')}/value"
},
"runAfter": {
"Increment_ItemNumber": [
"SUCCEEDED"
]
}
},
"HTTP_CallSelf": {
"type": "Http",
"inputs": {
"uri": "@body('Get_secret')?['value']",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"x-current-item-number": "@{variables('ItemNumber')}",
"x-turbo360-batchid": "@{variables('BatchId')}",
"x-turbo360-activityid": "@{variables('ActivityId')}",
"x-turbo360-businessidentifier": "@{variables('BusinessIdentifier')}",
"x-turbo360-externalidentifier": "@{variables('ExternalIdentifier')}"
},
"body": "@triggerBody()"
},
"runAfter": {
"Get_secret": [
"SUCCEEDED"
]
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
},
"Increment_ItemNumber": {
"type": "IncrementVariable",
"inputs": {
"name": "ItemNumber",
"value": 1
}
}
}
},
"runAfter": {
"HTTP_PUT_StorageItem_ByInboundDelivery": [
"SUCCEEDED"
]
}
},
"ComposeHttpErrorHeader": {
"type": "Compose",
"inputs": "@addProperty(addProperty(variables('Turbo360BaseHeader'),'ErrorMessage',coalesce(outputs('HTTP_PUT_StorageItem_ByInboundDelivery')?['body']?['error']?['message'],outputs('HTTP_PUT_StorageItem_ByInboundDelivery')?['body']?['message'])), 'ErrorCode', outputs('HTTP_PUT_StorageItem_ByInboundDelivery')?['statusCode'])",
"runAfter": {
"HTTP_PUT_StorageItem_ByInboundDelivery": [
"TIMEDOUT",
"FAILED"
]
}
},
"CheckPoint_Turbo360_Outbound_Order_Error-copy": {
"type": "Http",
"inputs": {
"uri": "@parameters('commonParamTurbo360BaseUri')",
"method": "POST",
"headers": {
"Ocp-Apim-Subscription-Key": "@{parameters('commonParamTurbo360SubscriptionId')}",
"Content-Type": "application/json"
},
"body": {
"archiveMessage": true,
"businessProcess": "@{parameters('commonParamTurbo360BusinessProcess')}",
"commandType": "CheckPointWithCorrelation",
"correlationPropertyName": "ActivityId",
"correlationPropertyValue": "@{variables('ActivityId')}",
"exceptionCode": "@{outputs('HTTP_PUT_StorageItem_ByInboundDelivery')?['statusCode']}",
"exceptionMessage": "@{coalesce(outputs('HTTP_PUT_StorageItem_ByInboundDelivery')?['body']?['error'],outputs('HTTP_PUT_StorageItem_ByInboundDelivery')?['body']?['message'])}",
"isTransactionComplete": true,
"messageBody": "@{string(body('Transform_JSON_To_JSON'))}",
"messageHeader": "@{outputs('ComposeHttpErrorHeader')}",
"stageName": "@{variables('Turbo360StageName')}",
"stageStatus": "Failure"
},
"authentication": {
"type": "ManagedServiceIdentity",
"identity": "@parameters('commonParamIdentityId')",
"audience": "@parameters('commonParamTurbo360Audience')"
}
},
"runAfter": {
"ComposeHttpErrorHeader": [
"SUCCEEDED"
]
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
},
"Terminate": {
"type": "Terminate",
"inputs": {
"runStatus": "Succeeded"
},
"runAfter": {
"CheckPoint_Turbo360_Outbound_Order_Error-copy": [
"SUCCEEDED"
]
}
}
}
}
}
},
"runAfter": {
"Initialize_Turbo360StageName": [
"SUCCEEDED"
]
}
},
"Initialize_ActivityId": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "ActivityId",
"type": "string",
"value": "@triggerOutputs()?['headers']?['x-turbo360-activityid']"
}
]
},
"runAfter": {
"Initialize_BusinessIdentifier": [
"SUCCEEDED"
]
}
},
"Initialize_Turbo360BatchId": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "BatchId",
"type": "string",
"value": "@triggerOutputs()?['headers']?['x-turbo360-batchid']"
}
]
},
"runAfter": {
"Initialize_ActivityId": [
"SUCCEEDED"
]
}
},
"Initialize_Turbo360BaseHeader": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "Turbo360BaseHeader",
"type": "object",
"value": {
"ActivityId": "@{variables('ActivityId')}",
"Action": "Receive CDM",
"BusinessIdentifier": "@{variables('BusinessIdentifier')}",
"ExternalIdentifier": "@{variables('ExternalIdentifier')}",
"Country": "BE",
"Destination": "",
"Environment": "@{parameters('commonEnvironment')}",
"Domain": "CGI",
"LogicAppName": "@{workflow()['name']}",
"LogicAppRunId": "@{workflow()['run']['name']}",
"ProcessEntity": "order",
"Source": ""
}
}
]
},
"runAfter": {
"Initialize_ExternalIdentifier": [
"SUCCEEDED"
]
}
},
"Initialize_BusinessIdentifier": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "BusinessIdentifier",
"type": "string",
"value": "@triggerOutputs()?['headers']?['x-turbo360-businessidentifier']"
}
]
},
"runAfter": {
"Response": [
"SUCCEEDED"
]
}
},
"Initialize_ExternalIdentifier": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "ExternalIdentifier",
"type": "string",
"value": "@triggerOutputs()?['headers']?['x-turbo360-externalidentifier']"
}
]
},
"runAfter": {
"Initialize_Turbo360BatchId": [
"SUCCEEDED"
]
}
},
"Initialize_EntityName": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "EntityName",
"type": "string",
"value": "@if(not(empty(triggerBody()?['outbound'])), 'outbound',if(not(empty(triggerBody()?['inbound'])),'inbound', 'corrections'))"
}
]
},
"runAfter": {
"Initialize_CurrentItem": [
"SUCCEEDED"
]
}
},
"Initialize_EntityValue": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "EntityValue",
"type": "object",
"value": "@if (not(empty(triggerBody()?['outbound'])), triggerBody()?['outbound'], if(not(empty(triggerBody()?['inbound'])), triggerBody()?['inbound'], triggerBody()?['corrections']))"
}
]
},
"runAfter": {
"Initialize_EntityName": [
"SUCCEEDED"
]
}
},
"Initialize_Turbo360StageName": {
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "Turbo360StageName",
"type": "string",
"value": "@if(equals(variables('EntityName'),'outbound'),'OutboundOrder', if(equals(variables('EntityName'),'inbound'), 'InboundOrder', 'Irregularity'))"
}
]
},
"runAfter": {
"Initialize_EntityValue": [
"SUCCEEDED"
]
}
},
"Log_Error": {
"type": "Http",
"inputs": {
"uri": "@parameters('commonParamTurbo360BaseUri')",
"method": "POST",
"headers": {
"Ocp-Apim-Subscription-Key": "@{parameters('commonParamTurbo360SubscriptionId')}",
"Content-Type": "application/json"
},
"body": {
"archiveMessage": true,
"businessProcess": "@{parameters('commonParamTurbo360BusinessProcess')}",
"commandType": "CheckPointWithCorrelation",
"correlationPropertyName": "ActivityId",
"correlationPropertyValue": "@{variables('ActivityId')}",
"exceptionCode": "500",
"exceptionMessage": "Please contact Support Integration",
"isTransactionComplete": true,
"messageBody": "@triggerBody()",
"messageHeader": "@{outputs('ComposeTurbo360Header')}",
"stageName": "@{variables('Turbo360StageName')}",
"stageStatus": "Failure",
"transactionName": ""
},
"authentication": {
"type": "ManagedServiceIdentity",
"identity": "@parameters('commonParamIdentityId')",
"audience": "@parameters('commonParamTurbo360Audience')"
}
},
"runAfter": {
"ComposeTurbo360Header": [
"SUCCEEDED"
]
},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
}
},
"ComposeTurbo360Header": {
"type": "Compose",
"inputs": "@addProperty(addProperty(variables('Turbo360BaseHeader'),'ErrorMessage','Please contact Support Integration'),'ErrorCode','500')",
"runAfter": {
"MainProcess": [
"TIMEDOUT",
"FAILED"
]
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"When_a_HTTP_request_is_received": {
"type": "Request",
"kind": "Http"
}
}
},
"kind": "Stateful"
}
```
### Screenshots or Videos
![Image]()
### Browser
Firefox
### Additional context
Logic App Standard
App Service Plan: WS2 (Windows)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.