Azure Logic app condition step not working properly

198 views Asked by At

I want to do automation that when anyone changes child task state to 'In Progress' their parent i.e. Product backlog Item's state gets update to 'Committed' automatically in azure board.

To achieve this have tried creating logic app but every time whilst running condition step is getting skipped with status 'Branching condition is not satisfied.

My Logic app designer looks as below

enter image description here

Here are my steps which am using in logic app. enter image description here

enter image description here

Condition as when task state is in progress and parent is equal to New enter image description here

when condition is true then run below step which is not running at the moment

enter image description here

Error am facing as below enter image description here

Here is conditions drop down reference for PBI which am using ![enter image description here

2

There are 2 answers

16
Ikhtesam Afrin On

Here I am trying to update the Parent Task's state from Doing to Done if Child Task's state changes to Done.

To achieve this have tried creating logic app but every time whilst running condition step is getting skipped with status 'Branching condition is not satisfied.

Please verify if your Condition is true, even I got the same error when my condition executed with false.

enter image description here

Or else verify if System.State: Committed is available in your work item dropdown.

enter image description here

Workflow:

enter image description here

Checking when parent's state is Doing and Child's state is Done, it will return true.

enter image description here

enter image description here

Output:

My workflow is getting executed successfully and state got changed to Done.

enter image description here

Please check, if both the fields in Condition action is populating correctly and executed with true status.

1
Ziyang Liu-MSFT On

Yesterday I created the same workflow as yours, and then encountered the same issue as yours. The "expressionResult" of Condition has always been false. What's interesting is that I created a new workflow with the same actions today, and it worked. Sharing my code with you, you can compare with yours and see if there are any differences. enter image description here

{
    "definition": {
        "$schema": "...",
        "actions": {
            "Condition": {
                "actions": {
                    "Update_a_work_item": {
                        "inputs": {
                            "body": {
                                "userEnteredFields": {
                                    "System.State": "Committed"
                                }
                            },
                            "host": {
                                "connection": {
                                    "referenceName": "visualstudioteamservices"
                                }
                            },
                            "method": "patch",
                            "path": "/_apis/wit/workitems/@{encodeURIComponent(body('Get_work_item_details')?['id'])}",
                            "queries": {
                                "account": "{org name}"
                            }
                        },
                        "type": "ApiConnection"
                    }
                },
                "else": {
                    "actions": {}
                },
                "expression": {
                    "and": [
                        {
                            "equals": [
                                "@triggerBody()?['fields']?['System_State']",
                                "In Progress"
                            ]
                        },
                        {
                            "equals": [
                                "@body('Get_work_item_details')?['fields']?['System_State']",
                                "New"
                            ]
                        }
                    ]
                },
                "runAfter": {
                    "Get_work_item_details": [
                        "SUCCEEDED"
                    ]
                },
                "type": "If"
            },
            "Get_work_item_details": {
                "inputs": {
                    "host": {
                        "connection": {
                            "referenceName": "visualstudioteamservices"
                        }
                    },
                    "method": "get",
                    "path": "/_apis/wit/workitems/@{encodeURIComponent(triggerBody()?['fields']?['System_Parent'])}",
                    "queries": {
                        "account": "{org name}",
                        "project": "{project name}",
                        "typeName": "Product Backlog Item"
                    }
                },
                "runAfter": {},
                "type": "ApiConnection"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "triggers": {
            "When_a_work_item_is_updated": {
                "inputs": {
                    "host": {
                        "connection": {
                            "referenceName": "visualstudioteamservices"
                        }
                    },
                    "method": "get",
                    "path": "/v2/workitemupdated_trigger/@{encodeURIComponent('{project name}')}/_apis/wit/wiql",
                    "queries": {
                        "account": "{org name}",
                        "wiql__System_WorkItemType": "Task"
                    }
                },
                "recurrence": {
                    "frequency": "Minute",
                    "interval": 3
                },
                "splitOn": "@triggerBody()?['value']",
                "type": "ApiConnection"
            }
        }
    },
    "kind": "Stateful"
}