{
"type": "If",
"expression": {
"and": [
{
"equals": [
"@triggerBody()?['Status']",
"Under Review"
]
}
]
},
"actions": {
"Start_and_wait_for_an_approval": {
"type": "OpenApiConnectionWebhook",
"inputs": {
"parameters": {
"approvalType": "BasicAwaitAll",
"WebhookApprovalCreationInput/title": "Approve SOP: @{trigger0utputs()?['body/DocumentName']}",
"WebhookApprovalCreationInput/assignedTo": "jenelle.champlin@monogramhealth.com;antonio.forbes@monogramhealth.com",
"WebhookApprovalCreationInput/details": "Please review the following document within 72 hrs:\n\nDocument Name: @{trigger0outputs()?['body/DocumentName']}\nType: @{trigger0utputs()?['body/DocumentType]}\nLink: @{trigger0utputs()?['body/Link_x0020_to_x0020_Document']}",
"WebhookApprovalCreationInput/enableNotifications": true,
"WebhookApprovalCreationInput/enableReassignment": true
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_approvals",
"connection": "shared_approvals",
"operationId": "StartAndWaitForAnApproval"
}
}
},
"Condition_1": {
"type": "If",
"expression": {
"and": [
{
"equals": [
"@outputs('Start_and_wait_for_an_approval')?['body/outcome']",
"Approve"
]
}
]
},
"actions": {
"Update_item": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"dataset": "https://monogramhealthcare.sharepoint.com/sites/MemberServices-LeadershipHub",
"table": "242fcf2e-c941-4188-a59a-3ffe556e5f34",
"id": "@triggerBody()?['ID']",
"item/Title": "@outputs('Start_and_wait_for_an_approval')?['body/title']",
"item/Status/Value": "Approved",
"item/ApprovalDate": "@utcNow()"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
"connection": "shared_sharepointonline",
"operationId": "PatchItem"
}
}
},
"Post_message_in_a_chat_or_channel": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"poster": "Flow bot",
"location": "Chat with Flow bot",
"body/recipient": "elyssa.duran@monogramhealth.com",
"body/messageBody": "<p class=\"editor-paragraph\">SOP Approved:</p><br><p class=\"editor-paragraph\">@{DocumentName}</p><p class=\"editor-paragraph\">Approved by: @{Reviewer} on @{utcNow()}</p>"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_teams",
"connection": "shared_teams",
"operationId": "PostMessageToConversation"
}
},
"runAfter": {
"Update_item": [
"SUCCEEDED"
]
}
}
},
"else": {
"actions": {
"Update_item_1": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"dataset": "https://monogramhealthcare.sharepoint.com/sites/MemberServices-LeadershipHub",
"table": "242fcf2e-c941-4188-a59a-3ffe556e5f34",
"id": "@triggerBody()?['ID']",
"item/Status/Value": "Needs Changes"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
"connection": "shared_sharepointonline",
"operationId": "PatchItem"
}
}
},
"Post_message_in_a_chat_or_channel_1": {
"type": "OpenApiConnection",
"inputs": {
"parameters": {
"poster": "Flow bot",
"location": "Chat with Flow bot",
"body/recipient": "elyssa.duran@monogramhealth.com",
"body/messageBody": "<p class=\"editor-paragraph\">The following document was not approved:</p><br><p class=\"editor-paragraph\">@{DocumentName}</p><p class=\"editor-paragraph\">@{Outcome}</p><p class=\"editor-paragraph\">@{Reviewer}</p><p class=\"editor-paragraph\">@{Notes}</p>"
},
"host": {
"apiId": "/providers/Microsoft.PowerApps/apis/shared_teams",
"connection": "shared_teams",
"operationId": "PostMessageToConversation"
}
},
"runAfter": {
"Update_item_1": [
"SUCCEEDED"
]
}
}
}
},
"runAfter": {
"Start_and_wait_for_an_approval": [
"SUCCEEDED"
]
}
}
},
"else": {
"actions": {}
},
"runAfter": {}
}