步骤 3. 使用 Power Automate 创建处理合同的流
你已创建合同管理频道并附加了 SharePoint 文档库。 下一步是创建 Power Automate 流来处理Microsoft Syntex模型标识和分类的协定。 可以通过在 SharePoint 文档库中创建 Power Automate 流来执行此步骤。
对于合同管理解决方案,需要创建 Power Automate 流以执行以下操作:
- 按Microsoft Syntex模型对合同进行分类后,将合同状态更改为“审阅中”。
- 然后评审合同,并被批准或拒绝。
- 对于已批准的合同,合同信息将发布到选项卡进行付款处理。
- 对于被拒绝的合同,系统会通知团队进行进一步分析。
下图显示了合同管理解决方案的 Power Automate 流。
准备合同以供审阅
当合同由非结构化文档处理模型标识和分类时,Power Automate 流将首先将状态更改为“ 审阅中”。
签出文件后,将状态值更改为 “审阅中”。
下一步是创建自适应卡指出合同正在等待评审,并将其发布到合同管理通道。
以下代码是在 Power Automate 流中用于此步骤的 JSON。
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Contract approval request",
"size": "large",
"weight": "bolder",
"wrap": true
},
{
"type": "Container",
"items": [
{
"type": "FactSet",
"spacing": "Large",
"facts": [
{
"title": "Client",
"value": "@{triggerOutputs()?['body/Client']}"
},
{
"title": "Contractor",
"value": "@{triggerOutputs()?['body/Contractor']}"
},
{
"title": "Fee amount",
"value": "@{triggerOutputs()?['body/FeeAmount']}"
},
{
"title": "Date created",
"value": "@{triggerOutputs()?['body/Modified']} "
},
{
"title": "Link",
"value": "[@{triggerOutputs()?['body/{FilenameWithExtension}']}](@{triggerOutputs()?['body/{Link}']})"
}
]
}
]
},
{
"type": "TextBlock",
"text": "Comment:"
},
{
"type": "Input.Text",
"placeholder": "Enter comments",
"id": "acComments"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Approve",
"data": {
"x": "Approve"
}
},
{
"type": "Action.Submit",
"title": "Reject",
"data": {
"x": "Reject"
}
}
]
}
条件上下文
在流中,接下来需要创建一个条件,使合同得到 批准 或 拒绝。
如果已批准合同
合同获得批准后,会发生以下情况:
在“合同”选项卡上,合同卡状态更改为“已批准”。
在流中,状态更改为“ 已批准”。
在此解决方案中,合同数据将添加到“ 付款 ”选项卡,以便可以管理付款。 可以扩展此过程,以允许流提交第三方财务应用程序付款合同, (例如 Dynamics CRM) 。
在流中,创建以下项,将已批准的合同移动到“ 付款 ”选项卡。
若要从 Teams 卡获取所需信息的表达式,请使用下表中显示的值。
名称 Expression 审批状态 body ('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response') ?['submitActionId'] 批准者 body ('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response') ?['responder']['displayName'] 审批日期 body ('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response') ?['responseTime'] 评论 body ('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response') ?['data']?['acComments'] 以下示例演示如何使用 Power Automate 中的公式框来编写表达式。
将创建一个自适应卡,指出合同已批准,并将其发布到合同管理通道。
以下代码是在 Power Automate 流中用于此步骤的 JSON。
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"style": "emphasis",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "CONTRACT APPROVED"
}
],
"width": "stretch"
}
]
}
],
"bleed": true
},
{
"type": "Container",
"items": [
{
"type": "FactSet",
"spacing": "Large",
"facts": [
{
"title": "Client",
"value": "@{triggerOutputs()?['body/Client']}"
},
{
"title": "Contractor",
"value": "@{triggerOutputs()?['body/Contractor']}"
},
{
"title": "Fee amount",
"value": "@{triggerOutputs()?['body/FeeAmount']}"
},
{
"title": "Approval by",
"value": "@{body('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response')?['responder']['displayName']}"
},
{
"title": "Approved date",
"value": "@{body('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response')?['responseTime']}"
},
{
"title": "Approval comment",
"value": "@{body('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response')?['data']?['acComments']}"
},
{
"title": " ",
"value": " "
},
{
"title": "Status",
"value": "Ready for payout"
}
]
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"fallbackText": "This card requires Adaptive Cards v1.2 support to be rendered properly."
}
如果合同被拒绝
当合同被拒绝时,会发生以下情况:
在“合同”选项卡上,合同卡状态更改为“已拒绝”。
在流中,检查合同文件,将状态更改为“已拒绝”,然后重新检查该文件。
在流中,创建一个自适应卡指出已拒绝合同。
以下代码是在 Power Automate 流中用于此步骤的 JSON。
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"style": "attention",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "CONTRACT REJECTED"
}
],
"width": "stretch"
}
]
}
],
"bleed": true
},
{
"type": "Container",
"items": [
{
"type": "FactSet",
"spacing": "Large",
"facts": [
{
"title": "Client",
"value": "@{triggerOutputs()?['body/Client']}"
},
{
"title": "Contractor",
"value": "@{triggerOutputs()?['body/Contractor']}"
},
{
"title": "Fee amount",
"value": "@{triggerOutputs()?['body/FeeAmount']}"
},
{
"title": "Rejected by",
"value": "@{body('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response')?['responder']['displayName']}"
},
{
"title": "Rejected date",
"value": "@{body('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response')?['responseTime']}"
},
{
"title": "Comment",
"value": "@{body('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response')?['data']?['acComments']}"
},
{
"title": " ",
"value": " "
},
{
"title": "Status",
"value": "Needs review"
}
]
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"fallbackText": "This card requires Adaptive Cards v1.2 support to be rendered properly."
}
卡发布在合同管理频道中。