是否可以检索当前 运行 开始的时间?
is it possible to retrieve the time when the current run started?
我们如何检索逻辑应用开始执行的日期时间?
在我们的逻辑应用程序中,我们目前正在设置一个变量来捕获工作流开始执行的日期时间,如下所示:
如何获取逻辑应用程序开始执行的时间而不必在开始捕获时声明变量utcNow()
?
目前没有直接的操作或函数来获取开始时间 属性,但是您可以在运行时使用 Rest API 和关联 ID 来获取它。这是 api 描述:Workflow Runs - Get.
资源组名称和工作流名称是静态的,关联 ID 是动态的,您可以使用 workflow()['run']['name']
来获取它。然后使用 body('HTTP')['properties']['startTime']
从响应中获取时间。
下面是我的流程
这就是结果,因为时区的缘故,所以你们相隔 8 小时。
希望对您有所帮助。
自@George Chen 在 2019 年的回答以来,一个更简单的选项(老实说可能已添加到 Azure Logic Apps)是使用 trigger()
表达式来获取 JSON 对象包含有关触发逻辑应用的内容的信息 运行。所需的值在此对象的 startTime
属性 中。下面是 trigger()
表达式 returns 作为我的逻辑应用程序的 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"
}
根据此对象和您喜欢的引用符号,您可以使用公式 @trigger().startTime
或 @trigger()?['startTime']
.
获取逻辑应用开始日期和时间 (UTC)
我们如何检索逻辑应用开始执行的日期时间?
在我们的逻辑应用程序中,我们目前正在设置一个变量来捕获工作流开始执行的日期时间,如下所示:
如何获取逻辑应用程序开始执行的时间而不必在开始捕获时声明变量utcNow()
?
目前没有直接的操作或函数来获取开始时间 属性,但是您可以在运行时使用 Rest API 和关联 ID 来获取它。这是 api 描述:Workflow Runs - Get.
资源组名称和工作流名称是静态的,关联 ID 是动态的,您可以使用 workflow()['run']['name']
来获取它。然后使用 body('HTTP')['properties']['startTime']
从响应中获取时间。
下面是我的流程
这就是结果,因为时区的缘故,所以你们相隔 8 小时。
希望对您有所帮助。
自@George Chen 在 2019 年的回答以来,一个更简单的选项(老实说可能已添加到 Azure Logic Apps)是使用 trigger()
表达式来获取 JSON 对象包含有关触发逻辑应用的内容的信息 运行。所需的值在此对象的 startTime
属性 中。下面是 trigger()
表达式 returns 作为我的逻辑应用程序的 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"
}
根据此对象和您喜欢的引用符号,您可以使用公式 @trigger().startTime
或 @trigger()?['startTime']
.