Open Ruprect opened 2 months ago
Consumption (Portal)
New Designer
Yes
{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "APIEndpoint_Payload": { "inputs": { "content": "@triggerBody()?['MessageText']", "schema": {} }, "runAfter": {}, "type": "ParseJson" }, "Catch": { "actions": { "Filter_array": { "inputs": { "from": "@union(union(union(result('Try'),result('Scope_-_Build_payload_for_Dataverse')),result('Update_existing_account,_or_create_new')),result('Is_there_an_existing_Email_Setup'))", "where": "@not(or(equals(item()['status'], 'Succeeded'),equals(item()['status'], 'Skipped')))" }, "runAfter": {}, "type": "Query" } }, "runAfter": { "Try": [ "TimedOut", "Skipped", "Failed" ] }, "type": "Scope" }, "Finally": { "actions": { "Compose": { "inputs": "@result('Catch')", "runAfter": {}, "type": "Compose" }, "Delete_message_(V2)_From_Queue": { "inputs": { "host": { "connection": { "name": "@parameters('$connections')['azurequeues']['connectionId']" } }, "method": "delete", "path": "/v2/storageAccounts/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/queues/@{encodeURIComponent('APIEndpoint-inbound')}/messages/@{encodeURIComponent(triggerBody()?['MessageId'])}", "queries": { "popreceipt": "@triggerBody()?['PopReceipt']" } }, "runAfter": { "Update_a_row_-_Set_Integration_Status,_Message_and_Timestamp": [ "Succeeded" ] }, "type": "ApiConnection" }, "Update_a_row_-_Set_Integration_Status,_Message_and_Timestamp": { "inputs": { "body": { "aba_integrationmessage": "Start integration to BC due to an update from APIEndpoint", "aba_integrationmessage_APIEndpoint": "Data received from APIEndpoint", "aba_integrationstatus_APIEndpoint": 2, "aba_integrationstatus_APIEndpointbc": 1, "aba_lastsynchronizationtimestamp": "@{utcNow()}", "aba_lastsynchronizationtimestamp_APIEndpoint": "@{utcNow()}" }, "headers": { "accept": "application/json;odata.metadata=full", "organization": "@parameters('CRM-Endpoint')", "prefer": "return=representation,odata.include-annotations=*" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice_1']['connectionId']" } }, "method": "patch", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('accounts'))}(@{encodeURIComponent(encodeURIComponent(outputs('Account_Id')))})" }, "runAfter": { "Compose": [ "Succeeded" ] }, "type": "ApiConnection" } }, "runAfter": { "Catch": [ "Succeeded", "Skipped", "Failed", "TimedOut" ] }, "type": "Scope" }, "Put_a_message_on_a_queue_-_Error_Handler": { "inputs": { "body": "{\n \"debugDetails\": @{parameters('DebugDetails')},\n \"workflowRunId\": @{workflow()['run']['id']},\n \"error\": {\n \"status\": \"Failed\",\n \"action\": @{actions('Try')},\n \"results\": @{union(result('Try'), result('Finally'))}\n }\n}", "host": { "connection": { "name": "@parameters('$connections')['errorhandlingqueue']['connectionId']" } }, "method": "post", "path": "/v2/storageAccounts/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/queues/@{encodeURIComponent('errorhandling-inbound')}/messages" }, "runAfter": { "Finally": [ "TimedOut", "Skipped", "Failed" ] }, "type": "ApiConnection" }, "Try": { "actions": { "Account_Id": { "inputs": "@coalesce(body('Update_a_row_-_Accounts')?['accountid'],body('Add_a_new_row_-_Accounts')?['accountid'])", "runAfter": { "Update_existing_account,_or_create_new": [ "Succeeded" ] }, "type": "Compose" }, "Get_Country_by_Code": { "inputs": { "headers": { "accept": "application/json;odata.metadata=full", "organization": "@parameters('CRM-Endpoint')", "prefer": "odata.include-annotations=*" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice']['connectionId']" } }, "method": "get", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('aba_countries'))}", "queries": { "$filter": "aba_country_code eq '@{first(body('APIEndpoint_Payload')?['addresses'])?['Country']}'" } }, "runAfter": { "List_rows_by_GUID_and_AccountNumber": [ "Succeeded" ] }, "type": "ApiConnection" }, "Get_existing_Email_Setups": { "inputs": { "headers": { "accept": "application/json;odata.metadata=full", "organization": "@parameters('CRM-Endpoint')", "prefer": "odata.include-annotations=*" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice']['connectionId']" } }, "method": "get", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('aba_emailsetups'))}", "queries": { "$filter": "_aba_accountid_value eq '@{outputs('Account_Id')}' and _aba_accountid_value ne null and aba_email eq '@{first(body('APIEndpoint_Payload')?['contacts'])?['Email']}' and aba_defaultlasernetemail eq true and statecode eq 0" } }, "runAfter": { "Account_Id": [ "Succeeded" ] }, "type": "ApiConnection" }, "Is_there_an_existing_Email_Setup": { "actions": {}, "else": { "actions": { "Add_a_new_row_(preview)": { "inputs": { "body": { "aba_Accountid@odata.bind": "accounts(@{outputs('Account_Id')})", "aba_defaultlasernetemail": true, "aba_documenttype": 745760000, "aba_email": "@{first(body('APIEndpoint_Payload')?['contacts'])?['email']}", "aba_sendbcc": false, "aba_sendcc": false, "aba_sendto": true }, "headers": { "organization": "@parameters('CRM-Endpoint')", "prefer": "return=representation,odata.include-annotations=*" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice_1']['connectionId']" } }, "method": "post", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('aba_emailsetups'))}" }, "runAfter": {}, "type": "ApiConnection" } } }, "expression": { "and": [ { "equals": [ "@not(empty(body('Get_existing_Email_Setups')?['value']))", "@true" ] } ] }, "runAfter": { "Get_existing_Email_Setups": [ "Succeeded" ] }, "type": "If" }, "List_rows_by_GUID_and_AccountNumber": { "inputs": { "headers": { "accept": "application/json;odata.metadata=full", "organization": "@parameters('CRM-Endpoint')", "prefer": "odata.include-annotations=*" }, "host": { "connection": { "name": "@parameters('$connections')['commondataservice']['connectionId']" } }, "method": "get", "path": "/api/data/v9.1/@{encodeURIComponent(encodeURIComponent('accounts'))}", "queries": { "$filter": "(aba_APIEndpointcustomerguid eq '@{body('APIEndpoint_Payload')?['guid']}' or aba_globalcustomernumber eq '@{body('APIEndpoint_Payload')?['accountNumber']}') and statecode eq 0" } }, "runAfter": {}, "type": "ApiConnection" }, "Scope_-_Build_payload_for_Dataverse": { "actions": { "Compose_-_AccountGroup": { "inputs": "@first(body('APIEndpoint_Payload')?['accountsReceivables'])?['accountGroup']", "runAfter": {}, "type": "Compose" }, "Condition_-_MVA_number_for_EFH": { "actions": { "Compose_-_Add_MVA_number_for_Norway": { "inputs": "@addProperty(outputs('Payload_for_Dataverse'),'new_eannumber',first(body('APIEndpoint_Payload')?['registrationNumbers'])?['number'])", "runAfter": {}, "type": "Compose" } }, "expression": { "and": [ { "equals": [ "@outputs('Compose_-_AccountGroup')", "EFH" ] } ] }, "runAfter": { "Payload_for_Dataverse": [ "Succeeded" ] }, "type": "If" }, "Condition_-_Relationship_Type_for_ASC": { "actions": { "Compose_-_Relationship_Type_=_Agent": { "inputs": 10, "runAfter": {}, "type": "Compose" } }, "expression": { "and": [ { "equals": [ "@outputs('Compose_-_AccountGroup')", "ASC" ] } ] }, "runAfter": { "Condition_-_Relationship_Type_for_TPY,_CRS,_EAN_or_EFH": [ "Succeeded" ] }, "type": "If" }, "Condition_-_Relationship_Type_for_TPY,_CRS,_EAN_or_EFH": { "actions": { "Compose_-_Relationship_Type_=_Customer": { "inputs": 3, "runAfter": {}, "type": "Compose" } }, "expression": { "or": [ { "equals": [ "@outputs('Compose_-_AccountGroup')", "TPY" ] }, { "equals": [ "@outputs('Compose_-_AccountGroup')", "CRS" ] }, { "equals": [ "@outputs('Compose_-_AccountGroup')", "EAN" ] }, { "equals": [ "@outputs('Compose_-_AccountGroup')", "EFH" ] } ] }, "runAfter": { "Compose_-_AccountGroup": [ "Succeeded" ] }, "type": "If" }, "Payload_for_Dataverse": { "inputs": { "_aba_country2_type": "aba_countries", "_aba_country2_value": "@{first(body('Get_Country_by_Code')?['value'])?['aba_countryid']}", "aba_APIEndpointcustomerguid": "@{body('APIEndpoint_Payload')?['guid']}", "aba_cwaccountnumber": "@{body('APIEndpoint_Payload')?['accountNumber']}", "aba_freightforwarding": true, "aba_vatno": "@{first(body('APIEndpoint_Payload')?['registrationNumbers'])?['Number']}", "address2_city": "@{first(body('APIEndpoint_Payload')?['addresses'])?['City']}", "address2_line1": "@{first(body('APIEndpoint_Payload')?['addresses'])?['Address1']}", "address2_line2": "@{first(body('APIEndpoint_Payload')?['addresses'])?['Address2']}", "address2_postalcode": "@{first(body('APIEndpoint_Payload')?['addresses'])?['PostalCode']}", "customertypecode": "@coalesce(outputs('Compose_-_Relationship_Type_=_Agent'),outputs('Compose_-_Relationship_Type_=_Customer'))", "name": "@{body('APIEndpoint_Payload')?['name']}" }, "runAfter": { "Condition_-_Relationship_Type_for_ASC": [ "Succeeded" ] }, "type": "Compose" } }, "runAfter": { "Get_Country_by_Code": [ "Succeeded" ] }, "type": "Scope" }, "Update_existing_account,_or_create_new": { "actions": { "Compose_-_Name_must_not_be_updated_after_the_initial_create_from_APIEndpoint": { "inputs": "@removeProperty(coalesce(outputs('Compose_-_Add_MVA_number_for_Norway'),outputs('Payload_for_Dataverse')),'name')", "runAfter": {}, "type": "Compose" }, "Update_a_row_-_Accounts": { "inputs": { "body": "@outputs('Compose_-_Name_must_not_be_updated_after_the_initial_create_from_APIEndpoint')", "host": { "connection": { "name": "@parameters('$connections')['commondataservice_1']['connectionId']" } }, "method": "patch", "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent(parameters('CRM-Endpoint')))}/tables/@{encodeURIComponent(encodeURIComponent('accounts'))}/items/@{encodeURIComponent(encodeURIComponent(first(body('List_rows_by_GUID_and_AccountNumber')?['value'])?['accountid']))}" }, "runAfter": { "Compose_-_Name_must_not_be_updated_after_the_initial_create_from_APIEndpoint": [ "Succeeded" ] }, "type": "ApiConnection" } }, "else": { "actions": { "Add_a_new_row_-_Accounts": { "inputs": { "body": "@outputs('Compose_-_Add_Default_Branch_to_new_Accounts')", "host": { "connection": { "name": "@parameters('$connections')['commondataservice_1']['connectionId']" } }, "method": "post", "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent(parameters('CRM-Endpoint')))}/tables/@{encodeURIComponent(encodeURIComponent('accounts'))}/items" }, "runAfter": { "Compose_-_Add_Default_Branch_to_new_Accounts": [ "Succeeded" ] }, "type": "ApiConnection" }, "Compose_-_Add_Default_Branch_to_new_Accounts": { "inputs": "@addProperty(outputs('Compose_-_On_create,_add_Segment_as_standard_to_Account'),'aba_department',first(body('Get_Country_by_Code')?['value'])?['aba_defaultbranch'])", "runAfter": { "Compose_-_On_create,_add_Segment_as_standard_to_Account": [ "Succeeded" ] }, "type": "Compose" }, "Compose_-_On_create,_add_Segment_as_standard_to_Account": { "inputs": "@addProperty(coalesce(outputs('Compose_-_Add_MVA_number_for_Norway'),outputs('Payload_for_Dataverse')),'aba_segment',100000001)", "runAfter": {}, "type": "Compose" } } }, "expression": { "and": [ { "equals": [ "@not(empty(body('List_rows_by_GUID_and_AccountNumber')?['value']))", "@true" ] } ] }, "runAfter": { "Scope_-_Build_payload_for_Dataverse": [ "Succeeded" ] }, "type": "If" } }, "runAfter": { "APIEndpoint_Payload": [ "Succeeded" ] }, "type": "Scope" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": { "$connections": { "defaultValue": {}, "type": "Object" }, "CRM-Endpoint": { "defaultValue": "https://<REMOVED ON PURPOSE>.crm4.dynamics.com/", "type": "String" }, "DebugDetails": { "defaultValue": { "customer": "Link Logistics", "objectName": "DeQueue-APIEndpoint-Inbound", "objectType": "Logic App", "resourcegroup": "CustomerName-Integration-Dev", "subscription": "crm-production", "tenantId": "<REMOVED ON PURPOSE>" }, "type": "Object" }, "Queue-Name": { "defaultValue": "APIEndpoint-inbound", "type": "String" } }, "triggers": { "When_there_are_messages_in_a_queue_-_APIEndpoint_Inbound": { "evaluatedRecurrence": { "frequency": "Second", "interval": 30 }, "inputs": { "host": { "connection": { "name": "@parameters('$connections')['azurequeues']['connectionId']" } }, "method": "get", "path": "/v2/storageAccounts/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/queues/@{encodeURIComponent('APIEndpoint-inbound')}/message_trigger", "queries": { "visibilitytimeout": "30" } }, "recurrence": { "frequency": "Second", "interval": 30 }, "runtimeConfiguration": { "concurrency": { "runs": 1 } }, "splitOn": "@triggerBody()?['QueueMessagesList']?['QueueMessage']", "type": "ApiConnection" } } }, "parameters": { "$connections": { "value": { "azurequeues": { "connectionId": "/subscriptions/<REMOVED ON PURPOSE>/resourceGroups/CustomerName-Integration-Dev/providers/Microsoft.Web/connections/azurequeues", "connectionName": "azurequeues", "id": "/subscriptions/<REMOVED ON PURPOSE>/providers/Microsoft.Web/locations/westeurope/managedApis/azurequeues" }, "commondataservice": { "connectionId": "/subscriptions/<REMOVED ON PURPOSE>/resourceGroups/CustomerName-Integration-Dev/providers/Microsoft.Web/connections/commondataservice", "connectionName": "commondataservice", "id": "/subscriptions/<REMOVED ON PURPOSE>/providers/Microsoft.Web/locations/westeurope/managedApis/commondataservice" }, "commondataservice_1": { "connectionId": "/subscriptions/<REMOVED ON PURPOSE>/resourceGroups/CustomerName-Integration-dev/providers/Microsoft.Web/connections/commondataservice-1", "connectionName": "commondataservice-1", "id": "/subscriptions/<REMOVED ON PURPOSE>/providers/Microsoft.Web/locations/westeurope/managedApis/commondataservice" }, "errorhandlingqueue": { "connectionId": "/subscriptions/<REMOVED ON PURPOSE>/resourceGroups/CustomerName-Integration-Dev/providers/Microsoft.Web/connections/errorhandlingqueue", "connectionName": "errorhandlingqueue", "id": "/subscriptions/<REMOVED ON PURPOSE>/providers/Microsoft.Web/locations/westeurope/managedApis/azurequeues" } } } } }
Google Chrome
No response
Hi @Ruprect, are you still experiencing this issue? If so I'll be taking a look at this during the upcoming week
Describe the Bug with repro steps
What type of Logic App Is this happening in?
Consumption (Portal)
Are you using new designer or old designer
New Designer
Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg
Yes
Workflow JSON
Screenshots or Videos
Browser
Google Chrome
Additional context
No response