是否可以检索当前运行开始的时间?

l--*_*''' 2 time timestamp azure-logic-apps

我们如何检索逻辑应用开始执行的日期时间?

在我们的逻辑应用程序中,我们当前设置一个变量只是为了捕获工作流开始执行的日期时间,如下所示:

在此输入图像描述

如何获取逻辑应用开始执行的时间,而无需在开始时声明变量来捕获utcNow()

Bla*_*len 5

一个更简单的选择(说实话,自 @George Chen 在 2019 年的回答以来,它可能已添加到 Azure 逻辑应用程序中)是使用表达式trigger()来获取 JSON 对象,该对象包含有关触发逻辑应用程序运行的信息。所需的值位于startTime该对象的属性中。trigger()下面是表达式为我的逻辑应用程序返回的 JSON 对象的示例,该对象由 HTTP 调用触发。这对于消息队列触发器应该是类似的:

{
  "name": "manual",
  "inputs": {
    "schema": {
      "properties": {
        "requestGUID": {
          "type": "string"
        }
      },
      "required": [
        "requestGUID"
      ],
      "type": "object"
    }
  },
  "outputs": {
    "headers": {
      "Accept": "*/*",
      "Host": "***.logic.azure.com",
      "User-Agent": "curl/7.79.1",
      "Content-Length": "54",
      "Content-Type": "application/json"
    },
    "body": {
      "requestGUID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
  },
  "startTime": "2022-02-22T02:14:47.5168196Z",
  "endTime": "2022-02-22T02:14:47.5168196Z",
  "trackingId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "clientTrackingId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "originHistoryName": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "status": "Succeeded"
}
Run Code Online (Sandbox Code Playgroud)

根据此对象以及您喜欢的引用符号,您可以使用公式@trigger().startTime或获取逻辑应用开始日期和时间 (UTC) @trigger()?['startTime']