首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么表达式在这种情况下不为真,尽管标题值是相同的?

为什么表达式在这种情况下不为真,尽管标题值是相同的?
EN

Stack Overflow用户
提问于 2022-11-01 20:38:18
回答 1查看 53关注 0票数 0

我正在编写一个逻辑应用程序,它检查在ADO中创建的一个新特性,然后它将评估标题是否包含一些关键字,比如“入职”,然后它将创建用户故事,如story1: Onboard New Hirestory2: Onboard Cloud Accounts等…。并将它们链接到创建的功能。

问题是这里的条件说明。

为了测试这一点,我创建了带有“hi”作为功能标题的假功能工作项,当我触发运行时,逻辑应用程序将检测创建的新功能,但是标题评估被评估为“false”。

我试过有双引号和没有双引号,有和没有通配符*,但它拒绝匹配它!

当创建工作项时,JSON输入:

代码语言:javascript
运行
复制
{
    "method": "get",
    "queries": {
        "account": "accountxyz",
        "areaPathComparison": "Equals",
        "iterationPathComparison": "Equals",
        "wiql__System_WorkItemType": "Feature"
    },
    "path": "/v2/workitemcreated_trigger/something%20something/_apis/wit/wiql",
    "host": {
        "connection": {
            "name": "/subscriptions/...dc/resourceGroups/rg-la/providers/Microsoft.Web/connections/visualstudioteamservices-1"
        }
    }
}

创建工作项时,JSON输出:

代码语言:javascript
运行
复制
{
    "headers": {
        "Pragma": "no-cache",
        "Transfer-Encoding": "chunked",
        "Retry-After": "15",
        "Vary": "Accept-Encoding",
        "Cache-Control": "no-store, no-cache",
        "Location": "https://logic-apis-centralus.azure-apim.net/apim/visualstudioteamservices/.../v2/workitemcreated_trigger/something%20something/_apis/wit/wiql?account=accountxyz&areaPathComparison=Equals&iterationPathComparison=Equals&wiql__System_WorkItemType=Feature&triggerState=ey...MX0=",
        "Set-Cookie": "A...1;Path=/;HttpOnly;Secure;Domain=vsts-cus.azconn-cus-001.p.azurewebsites.net,ARRAffinitySameSite=b...1;Path=/;HttpOnly;SameSite=None;Secure;Domain=vsts-cus.azconn-cus-001.p.azurewebsites.net",
        "x-ms-request-id": "0...4",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "false",
        "x-ms-apihub-obo": "false",
        "Date": "Tue, 01 Nov 2022 20:27:59 GMT",
        "Content-Type": "application/json",
        "Expires": "-1",
        "Content-Length": "2911"
    },
    "body": {
        "id": 31,
        "rev": 1,
        "url": "https://accountxyz.visualstudio.com/_apis/wit/workItems/31",
        "fields": {
            "System_Id": 31,
            "System_AreaId": 391,
            "System_AreaPath": "something something",
            "System_TeamProject": "something something",
            "System_NodeName": "something something",
            "System_AreaLevel1": "something something",
            "System_Rev": 1,
            "System_AuthorizedDate": "2022-11-01T20:27:59.287Z",
            "System_RevisedDate": "9999-01-01T00:00:00Z",
            "System_IterationId": 386,
            "System_IterationPath": "something something",
            "System_IterationLevel1": "something something",
            "System_WorkItemType": "Feature",
            "System_State": "New",
            "System_Reason": "New",
            "System_CreatedDate": "2022-11-01T20:27:59.287Z",
            "System_CreatedBy": "user1",
            "System_ChangedDate": "2022-11-01T20:27:59.287Z",
            "System_ChangedBy": "user1",
            "System_AuthorizedAs": "user1",
            "System_PersonId": 4...9,
            "System_Watermark": 95043,
            "System_CommentCount": 0,
            "System_Title": "hi",
            "System_BoardColumn": "New",
            "System_BoardColumnDone": false,
            "Microsoft_VSTS_Common_StateChangeDate": "2022-11-01T20:27:59.287Z",
            "Microsoft_VSTS_Common_Priority": 2,
            "Microsoft_VSTS_Common_ValueArea": "Business",
            "WEF_1...C_System_ExtensionMarker": true,
            "WEF_1...C_Kanban_Column": "New",
            "WEF_1...C_Kanban_Column_Done": false,
            "System_ExternalLinkCount": null,
            "System_IterationLevel7": null,
            "System_IterationLevel6": null,
            "System_IterationLevel5": null,
            "System_IterationLevel4": null,
            "System_IterationLevel3": null,
            "System_IterationLevel2": null,
            "System_AreaLevel7": null,
            "System_AreaLevel6": null,
            "System_AreaLevel5": null,
            "System_AreaLevel4": null,
            "System_AreaLevel3": null,
            "System_AreaLevel2": null,
            "System_Parent": null,
            "System_RemoteLinkCount": null,
            "System_HyperLinkCount": null,
            "System_AttachedFileCount": null,
            "System_AssignedTo": null,
            "System_Description": null,
            "System_History": null,
            "System_RelatedLinkCount": null,
            "System_Tags": null,
            "System_BoardLane": null,
            "Microsoft_VSTS_Common_ActivatedDate": null,
            "Microsoft_VSTS_Common_ActivatedBy": null,
            "Microsoft_VSTS_Common_ResolvedDate": null,
            "Microsoft_VSTS_Common_ResolvedBy": null,
            "Microsoft_VSTS_Common_ResolvedReason": null,
            "Microsoft_VSTS_Common_ClosedDate": null,
            "Microsoft_VSTS_Common_ClosedBy": null,
            "Microsoft_VSTS_Common_Risk": null,
            "Microsoft_VSTS_Common_StackRank": null,
            "Microsoft_VSTS_Scheduling_TargetDate": null,
            "Microsoft_VSTS_Scheduling_StartDate": null,
            "Microsoft_VSTS_Common_BusinessValue": null,
            "Microsoft_VSTS_Common_TimeCriticality": null,
            "Microsoft_VSTS_Scheduling_Effort": null,
            "Microsoft_VSTS_Build_IntegrationBuild": null,
            "Vsts_AssignedToEmail": "",
            "Vsts_WorkItemUrl": "https://accountxyz.visualstudio.com/_apis/wit/workItems/31"
        }
    }
}

条件JSON定义:

代码语言:javascript
运行
复制
"definition": {
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "actions": {
        "Condition": {
            "actions": {},
            "expression": {
                "and": [
                    {
                        "contains": [
                            "@triggerBody()?['fields']?['System_Title']",
                            "hi"
                        ]
                    }
                ]
            },
            "runAfter": {},
            "type": "If"
        }
    },
    "contentVersion": "1.0.0.0",
    "outputs": {},
    "parameters": {
        "$connections": {
            "defaultValue": {},
            "type": "Object"
        }
    },
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-11-02 23:53:36

将条件更改为

代码语言:javascript
运行
复制
"Condition": {
    "actions": {},
    "expression": {
        "and": [
            {
                "equals": [
                    "@contains(triggerBody()?['fields']?['System_Title'], 'hi')",
                    "true"
                ]
            }
        ]
    },
    "runAfter": {},
    "type": "If"
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74281524

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档