我正在编写一个逻辑应用程序,它检查在ADO中创建的一个新特性,然后它将评估标题是否包含一些关键字,比如“入职”,然后它将创建用户故事,如story1: Onboard New Hire
、story2: Onboard Cloud Accounts
等…。并将它们链接到创建的功能。
问题是这里的条件说明。
为了测试这一点,我创建了带有“hi”作为功能标题的假功能工作项,当我触发运行时,逻辑应用程序将检测创建的新功能,但是标题评估被评估为“false”。
我试过有双引号和没有双引号,有和没有通配符*,但它拒绝匹配它!
当创建工作项时,JSON输入:
{
"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输出:
{
"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定义:
"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"
}
},
发布于 2022-11-02 23:53:36
将条件更改为
"Condition": {
"actions": {},
"expression": {
"and": [
{
"equals": [
"@contains(triggerBody()?['fields']?['System_Title'], 'hi')",
"true"
]
}
]
},
"runAfter": {},
"type": "If"
}
https://stackoverflow.com/questions/74281524
复制相似问题