diff --git a/samples/manage-approvals/.DS_Store b/samples/manage-approvals/.DS_Store new file mode 100644 index 00000000..64045464 Binary files /dev/null and b/samples/manage-approvals/.DS_Store differ diff --git a/samples/manage-approvals/README.md b/samples/manage-approvals/README.md new file mode 100644 index 00000000..43955a7d --- /dev/null +++ b/samples/manage-approvals/README.md @@ -0,0 +1,79 @@ +# Manage your Power Platform Approvals inside Power Apps + +## Summary + +This sample solution demonstrates how to manage your Approvals in a Power App by updating the relevant Approvals tables in Dataverse. + +## Canvas Power App +* Manage Approvals App + +#### Manage Approvals App +* This Canvas app displays all pending approvals (***Approve/Reject - First to Respond Only***) for the current user. +* Users have the ability to select items and approve or reject them individually or in bulk. + +#### Pending approvals +![preview01](assets/preview01.png) + +#### No pending approvals +![preview01](assets/preview02.png) + +## Flow +* Set Approval Result + +#### Set Approval Result +* This flow updates the relevant Dataverse tables and also initiates a POST request to ensure the "Waiting for Approval" action in Power Automate proceeds rather than remaining in a waiting state. +* Once this flow is executed, it will no longer be possible to Approve or Reject the item through the adaptive card sent in an email or via Microsoft Teams. + +![preview03](assets/preview03.png) + +## Applies to + +* [Microsoft Power Automate](https://docs.microsoft.com/power-automate/) +* [Microsoft Power Apps](https://docs.microsoft.com/power-apps) + +## Compatibility + +![Premium License](https://img.shields.io/badge/Premium%20License-Required-green.svg "Premium license required") +![On-Premises Connectors](https://img.shields.io/badge/On--Premises%20Connectors-No-green.svg "Does not use on-premise connectors") +![Custom Connectors](https://img.shields.io/badge/Custom%20Connectors-Not%20Required-green.svg "Does not use custom connectors") + +## Authors + +Solution|Author(s) +--------|--------- +manage-approvals | [Gabriel Koolman](https://www.linkedin.com/in/gabrielkoolman/) + +## Version history + +Version|Date|Comments +-------|----|-------- +1.0|November 12, 2023|Initial release + +## Minimal Path to Awesome + +* [Download](solution/manage-approvals.zip) the `.zip` file from the `solution` folder +* Import the solution by going to the [Power Apps Portal](https://make.powerapps.com) and clicking on **"Import Solution"** +* Make sure you have the **Approval User** and **Approval Administrator** security role + +## Using the Source Code + +You can also use the [Power Platform CLI](https://docs.microsoft.com/powerapps/developer/data-platform/powerapps-cli) to pack the source code by following these steps:: + +* Clone the repository to a local drive +* Pack the source files back into a solution `.zip` file: + ```bash + pac solution pack --zipfile pathtodestinationfile --folder pathtosourcefolder + ``` + Making sure to replace `pathtosourcefolder` to point to the path to this sample's `sourcecode` folder, and `pathtodestinationfile` to point to the path of this solution's `.zip` file (located under the `solution` folder) +* Within **Power Apps Studio**, import the solution `.zip` file using **Solutions** > **Import Solution** and select the `.zip` file you just packed. + +## Disclaimer + +**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** + +## For more information + +- [Overview of creating apps in Power Apps](https://docs.microsoft.com/powerapps/maker/) +- [Power Apps canvas apps documentation](https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/) + + diff --git a/samples/manage-approvals/assets/preview01.png b/samples/manage-approvals/assets/preview01.png new file mode 100644 index 00000000..ade3846d Binary files /dev/null and b/samples/manage-approvals/assets/preview01.png differ diff --git a/samples/manage-approvals/assets/preview02.png b/samples/manage-approvals/assets/preview02.png new file mode 100644 index 00000000..3af06e45 Binary files /dev/null and b/samples/manage-approvals/assets/preview02.png differ diff --git a/samples/manage-approvals/assets/preview03.png b/samples/manage-approvals/assets/preview03.png new file mode 100644 index 00000000..efbe48dd Binary files /dev/null and b/samples/manage-approvals/assets/preview03.png differ diff --git a/samples/manage-approvals/solution/.DS_Store b/samples/manage-approvals/solution/.DS_Store new file mode 100644 index 00000000..5008ddfc Binary files /dev/null and b/samples/manage-approvals/solution/.DS_Store differ diff --git a/samples/manage-approvals/solution/manage-approvals.zip b/samples/manage-approvals/solution/manage-approvals.zip new file mode 100644 index 00000000..b7a7097a Binary files /dev/null and b/samples/manage-approvals/solution/manage-approvals.zip differ diff --git a/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3.meta.xml b/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3.meta.xml new file mode 100644 index 00000000..1952614a --- /dev/null +++ b/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3.meta.xml @@ -0,0 +1,31 @@ + + + gk_manageapprovalsapp_efeb3 + 2023-11-12T12:18:47Z + Ready + 3.23105.17.0 + 3.23105.17.0 + {"primaryDeviceWidth":"1366","primaryDeviceHeight":"768","supportsPortrait":"true","supportsLandscape":"true","primaryFormFactor":"Tablet","showStatusBar":"false","publisherVersion":"3.23105.17","minimumRequiredApiVersion":"2.2.0","hasComponent":"false","hasUnlockedComponent":"false","isUnifiedRootApp":"false","sienaVersion":"20231112T120806Z-3.23105.17.0"} + 0 + + RGBA(0,176,240,1) + Manage Approvals App + + + + [] + {"13b65b5d-93d7-4fff-87b7-abd0058dfb9c":{"id":"/providers/microsoft.powerapps/apis/shared_logicflows","displayName":"Logic flows","iconUri":"https://connectoricons-prod.azureedge.net/releases/v1.0.1664/1.0.1664.3477/logicflows/icon.png","dataSources":["Setapprovalresult"],"dependencies":["551148b1-cd13-47f0-a2b4-b09a2276134a"],"dependents":[],"parameterHints":{"workflowName":{"value":"3937159a-190e-422f-b154-374dbe4598f5"},"workflowEntityId":{"value":"e698fd41-5d76-ee11-8179-0022489fd9dd"},"551148b1-cd13-47f0-a2b4-b09a2276134a":{"value":"shared_commondataserviceforapps_1"}},"parameterHintsV2":{"workflowName":{"value":"3937159a-190e-422f-b154-374dbe4598f5"},"workflowEntityId":{"value":"e698fd41-5d76-ee11-8179-0022489fd9dd"},"shared_commondataserviceforapps_1":{"value":"551148b1-cd13-47f0-a2b4-b09a2276134a"}},"isOnPremiseConnection":false,"bypassConsent":false,"dataSets":{},"apiTier":"Standard","actions":["Run"]},"551148b1-cd13-47f0-a2b4-b09a2276134a":{"id":"/providers/microsoft.powerapps/apis/shared_commondataserviceforapps","displayName":"Microsoft Dataverse","iconUri":"https://connectoricons-prod.azureedge.net/releases/v1.0.1664/1.0.1664.3477/commondataserviceforapps/icon.png","dataSources":[],"dependencies":[],"dependents":["13b65b5d-93d7-4fff-87b7-abd0058dfb9c"],"parameterHints":{},"parameterHintsV2":{},"isOnPremiseConnection":false,"bypassConsent":false,"dataSets":{},"apiTier":"Premium"}} + {"default.cds":{"databaseDetails":{"referenceType":"Environmental","environmentName":"default.cds","overrideValues":{"status":"NotSpecified","environmentVariableName":""}},"dataSources":{"Approvals":{"entitySetName":"msdyn_flow_approvals","logicalName":"msdyn_flow_approval"},"Users":{"entitySetName":"systemusers","logicalName":"systemuser"},"Approval Requests":{"entitySetName":"msdyn_flow_approvalrequests","logicalName":"msdyn_flow_approvalrequest"}}}} + [] + [] + 1 + 0 + 0 + 0 + + 1.0 + {"cdsdependencies":[{"dependencyid":"e698fd41-5d76-ee11-8179-0022489fd9dd","componenttype":29,"componenttypeplatformname":"Workflow"},{"logicalname":"msdyn_flow_approval","componenttype":1},{"logicalname":"systemuser","componenttype":1},{"logicalname":"msdyn_flow_approvalrequest","componenttype":1}]} + 1 + /CanvasApps/gk_manageapprovalsapp_efeb3_BackgroundImageUri + /CanvasApps/gk_manageapprovalsapp_efeb3_DocumentUri.msapp + \ No newline at end of file diff --git a/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3_BackgroundImageUri b/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3_BackgroundImageUri new file mode 100644 index 00000000..c67f0065 Binary files /dev/null and b/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3_BackgroundImageUri differ diff --git a/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3_DocumentUri.msapp b/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3_DocumentUri.msapp new file mode 100644 index 00000000..0d4515e7 Binary files /dev/null and b/samples/manage-approvals/sourcecode/CanvasApps/gk_manageapprovalsapp_efeb3_DocumentUri.msapp differ diff --git a/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approval/Entity.xml b/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approval/Entity.xml new file mode 100644 index 00000000..a31edc46 --- /dev/null +++ b/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approval/Entity.xml @@ -0,0 +1,5 @@ + + + msdyn_flow_approval + + \ No newline at end of file diff --git a/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approval/RibbonDiff.xml b/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approval/RibbonDiff.xml new file mode 100644 index 00000000..59d20483 --- /dev/null +++ b/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approval/RibbonDiff.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approvalrequest/Entity.xml b/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approvalrequest/Entity.xml new file mode 100644 index 00000000..4702f19e --- /dev/null +++ b/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approvalrequest/Entity.xml @@ -0,0 +1,5 @@ + + + msdyn_flow_approvalrequest + + \ No newline at end of file diff --git a/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approvalrequest/RibbonDiff.xml b/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approvalrequest/RibbonDiff.xml new file mode 100644 index 00000000..59d20483 --- /dev/null +++ b/samples/manage-approvals/sourcecode/Entities/msdyn_flow_approvalrequest/RibbonDiff.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/samples/manage-approvals/sourcecode/Other/Customizations.xml b/samples/manage-approvals/sourcecode/Other/Customizations.xml new file mode 100644 index 00000000..4018cd2c --- /dev/null +++ b/samples/manage-approvals/sourcecode/Other/Customizations.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + Microsoft Dataverse - Manage Approvals + /providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps + 1 + 0 + 1 + + + + 1033 + + \ No newline at end of file diff --git a/samples/manage-approvals/sourcecode/Other/Solution.xml b/samples/manage-approvals/sourcecode/Other/Solution.xml new file mode 100644 index 00000000..f70245cf --- /dev/null +++ b/samples/manage-approvals/sourcecode/Other/Solution.xml @@ -0,0 +1,137 @@ + + + + Manage_Approvals + + + + + 1.0.0.0 + 0 + + GabrielKoolman + + + + + + + gk + 12276 + +
+ 1 + 1 + + + + + + + + + + + + + + + + 1 + + + + + + + + +
+
+ 2 + 1 + + + + + + + + + + + + + + + + 1 + + + + + + + + +
+
+
+ + + + + + + + + + msdyn_FlowApprovals (2.0.4.8) + + + + + + msdyn_FlowApprovals (2.0.4.8) + + + + + + msdyn_FlowApprovals (2.0.4.8) + + + + + + msdyn_FlowApprovals (2.0.4.8) + + + + + + msdyn_FlowApprovals (2.0.4.8) + + + + + + msdyn_FlowApprovals (2.0.4.8) + + + + + + msdyn_FlowApprovals (2.0.4.8) + + + + + + msdyn_FlowApprovals (2.0.4.8) + + + + +
+
\ No newline at end of file diff --git a/samples/manage-approvals/sourcecode/Workflows/Setapprovalresult-E698FD41-5D76-EE11-8179-0022489FD9DD.json b/samples/manage-approvals/sourcecode/Workflows/Setapprovalresult-E698FD41-5D76-EE11-8179-0022489FD9DD.json new file mode 100644 index 00000000..3391543d --- /dev/null +++ b/samples/manage-approvals/sourcecode/Workflows/Setapprovalresult-E698FD41-5D76-EE11-8179-0022489FD9DD.json @@ -0,0 +1,462 @@ +{ + "properties": { + "connectionReferences": { + "shared_commondataserviceforapps_1": { + "runtimeSource": "embedded", + "connection": { + "connectionReferenceLogicalName": "ggk_MicrosoftDataverseManageApprovals" + }, + "api": { + "name": "shared_commondataserviceforapps" + } + } + }, + "definition": { + "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "$connections": { + "defaultValue": {}, + "type": "Object" + }, + "$authentication": { + "defaultValue": {}, + "type": "SecureObject" + } + }, + "triggers": { + "manual": { + "metadata": { + "operationMetadataId": "14a030d0-1ed0-49a2-bb89-22601cdd13e4" + }, + "type": "Request", + "kind": "PowerAppV2", + "inputs": { + "schema": { + "type": "object", + "properties": { + "text": { + "title": "currentUserEmail", + "type": "string", + "x-ms-dynamically-added": true, + "description": "Please enter your input", + "x-ms-content-hint": "TEXT" + }, + "text_1": { + "description": "Please enter your input", + "title": "flowApprovals", + "type": "string", + "x-ms-content-hint": "TEXT", + "x-ms-dynamically-added": true + }, + "text_2": { + "title": "outcome", + "type": "string", + "x-ms-dynamically-added": true, + "description": "Please enter your input", + "x-ms-content-hint": "TEXT" + }, + "text_3": { + "title": "currentUserDisplayName", + "type": "string", + "x-ms-dynamically-added": true, + "description": "Please enter your input", + "x-ms-content-hint": "TEXT" + }, + "text_4": { + "title": "currentUserGUID", + "type": "string", + "x-ms-dynamically-added": true, + "description": "Please enter your input", + "x-ms-content-hint": "TEXT" + }, + "text_5": { + "title": "comments", + "type": "string", + "x-ms-dynamically-added": true, + "description": "Please enter your input", + "x-ms-content-hint": "TEXT" + }, + "text_6": { + "title": "completionTime", + "type": "string", + "x-ms-dynamically-added": true, + "description": "Please enter your input", + "x-ms-content-hint": "TEXT" + } + }, + "required": [ + "text", + "text_1", + "text_2", + "text_3", + "text_4", + "text_5", + "text_6" + ] + } + } + } + }, + "actions": { + "Parse_JSON_-_Approvals": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "6287eeff-f0d2-4482-b37a-c6b15422a5ac" + }, + "type": "ParseJson", + "inputs": { + "content": "@triggerBody()['text_1']", + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "approvalId": { + "type": "string" + } + }, + "required": [ + "approvalId" + ] + } + } + } + }, + "Apply_to_each": { + "foreach": "@body('Parse_JSON_-_Approvals')", + "actions": { + "Get_a_row_by_ID_-_Approvals": { + "runAfter": {}, + "metadata": { + "operationMetadataId": "7aa80b25-bd21-448e-9b23-de705af9d4fc" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_commondataserviceforapps_1", + "operationId": "GetItem", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps" + }, + "parameters": { + "entityName": "msdyn_flow_approvals", + "recordId": "@items('Apply_to_each')?['approvalId']" + }, + "authentication": "@parameters('$authentication')" + } + }, + "Compose_-_Current_Flow_Notification_Uri": { + "runAfter": { + "Get_items_Flow_Approvals": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "115e4159-457e-480e-a183-79d73f612e49" + }, + "type": "Compose", + "inputs": "@first(body('Get_items_Flow_Approvals')?['value'])?['msdyn_flow_flowapproval_flownotificationuri']" + }, + "Compose_-_responseSummary": { + "runAfter": { + "Compose_-_Current_Flow_Notification_Uri": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "5deb0bef-73f7-4a7e-8414-b0c414c9d7da" + }, + "type": "Compose", + "inputs": "Approver: @{triggerBody()['text_3']}, @{triggerBody()['text']}\nResponse: @{if(equals(triggerBody()['text_2'], 'Approve'), 'Approve', 'Reject')}\nRequest Date: @{formatDateTime(body('Get_a_row_by_ID_-_Approvals')?['createdon'], 'dddd, MMMM dd, yyyy hh:mm:ss tt')}\nResponse Date: @{formatDateTime(utcNow(), 'dddd, MMMM dd, yyyy hh:mm:ss tt')}" + }, + "HTTP_-_Set_'Waiting_for_an_Approval'_action": { + "runAfter": { + "Compose_-_responseSummary": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "6fe0f6c6-94cf-4d16-9e47-1eac4f63472a" + }, + "type": "Http", + "inputs": { + "method": "POST", + "uri": "@{outputs('Compose_-_Current_Flow_Notification_Uri')}", + "headers": { + "Content-Type": "application/json" + }, + "body": { + "responses": [ + { + "responder": { + "id": "@{triggerBody()['text_4']}", + "displayName": "@{triggerBody()['text_3']}", + "email": "@{triggerBody()['text']}", + "tenantId": "67fb2df5-b03d-4524-b34e-65954a9b1f3d", + "userPrincipalName": "@{triggerBody()['text']}" + }, + "requestDate": "@{outputs('Get_a_row_by_ID_-_Approvals')?['body/createdon']}", + "responseDate": "@{triggerBody()['text_6']}", + "approverResponse": "@{if(equals(triggerBody()['text_2'], 'Approve'), 'Approve', 'Reject')}", + "comments": "@{triggerBody()['text_5']}" + } + ], + "responseSummary": "@{outputs('Compose_-_responseSummary')}", + "completionDate": "@{triggerBody()['text_6']}", + "outcome": "@{if(equals(triggerBody()['text_2'], 'Approve'), 'Approve', 'Reject')}", + "name": "@{items('Apply_to_each')?['msdyn_flow_approvalid']}", + "title": "@{outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_title']}", + "details": "@{outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_details']}", + "requestDate": "@{outputs('Get_a_row_by_ID_-_Approvals')?['body/createdon']}", + "expirationDate": "9999-12-31T23:59:59Z" + }, + "retryPolicy": { + "type": "fixed", + "count": 5, + "interval": "PT20S" + } + } + }, + "Get_items_Flow_Approvals": { + "runAfter": { + "Get_Flow_Approvals": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "42d2afbf-8afe-4056-a87e-e0926909c54a" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_commondataserviceforapps_1", + "operationId": "ListRecords", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps" + }, + "parameters": { + "entityName": "msdyn_flow_flowapprovals", + "$filter": "msdyn_flow_flowapproval_flowrunsequenceid eq '@{first(body('Get_Flow_Approvals')?['value'])?['msdyn_flow_flowapproval_flowrunsequenceid']}' and startswith(msdyn_flow_flowapproval_flownotificationuri,'https')" + }, + "authentication": "@parameters('$authentication')", + "retryPolicy": { + "type": "fixed", + "count": 5, + "interval": "PT20S" + } + } + }, + "Update_a_row_-_Approvals": { + "runAfter": { + "Get_a_row_by_ID_-_Approvals": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "c7bede58-7af3-4964-b4e3-577ec570f20c" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_commondataserviceforapps_1", + "operationId": "UpdateRecord", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps" + }, + "parameters": { + "entityName": "msdyn_flow_approvals", + "recordId": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approvalid']", + "item/msdyn_flow_approval_modelid": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_modelid']", + "item/msdyn_flow_approval_modeltype": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_modeltype']", + "item/msdyn_flow_approval_approvalstagekey": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_approvalstagekey']", + "item/msdyn_flow_approval_name": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_name']", + "item/msdyn_flow_approval_stage": 192351000, + "item/statuscode": 192350004, + "item/msdyn_flow_approval_title": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_title']", + "item/msdyn_flow_approval_allowcancel": true, + "item/msdyn_flow_approval_allowreassign": false, + "item/msdyn_flow_approval_completedon": "@triggerBody()['text_6']", + "item/msdyn_flow_approval_itemlink": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_itemlink']", + "item/msdyn_flow_approval_itemlinkdescription": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_itemlinkdescription']", + "item/msdyn_flow_approval_itemlinkhash": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_itemlinkhash']", + "item/msdyn_flow_approval_requesttype": 192350001, + "item/msdyn_flow_approval_result": "@if(equals(triggerBody()['text_2'], 'Approve'), 'Approve', 'Reject')", + "item/msdyn_flow_approval_sendemail": false, + "item/statecode": 1 + }, + "authentication": "@parameters('$authentication')", + "retryPolicy": { + "type": "fixed", + "count": 5, + "interval": "PT20S" + } + } + }, + "Add_a_new_row_-_Approval_Response": { + "runAfter": { + "Update_a_row_-_Approvals": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "bad81cbb-5e14-4bcc-8c33-42d886b504ab" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_commondataserviceforapps_1", + "operationId": "CreateRecord", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps" + }, + "parameters": { + "entityName": "msdyn_flow_approvalresponses", + "item/msdyn_flow_approvalresponse_approval@odata.bind": "msdyn_flow_approvals(@{outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approvalid']})", + "item/msdyn_flow_approvalresponse_approvalstagekey": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_approvalstagekey']", + "item/msdyn_flow_approvalresponse_name": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approval_name']", + "item/msdyn_flow_approvalresponse_response": "@if(equals(triggerBody()['text_2'], 'Approve'), 'Approve', 'Reject')", + "item/msdyn_flow_approvalresponse_stage": 192350001, + "item/statuscode": 192350002, + "item/msdyn_flow_approvalresponseidx_approvalid": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approvalid']", + "item/msdyn_flow_approvalresponse_comments": "@triggerBody()['text_5']", + "item/msdyn_flow_approvalresponseidx_stage": "BASIC", + "item/statecode": 1 + }, + "authentication": "@parameters('$authentication')", + "retryPolicy": { + "type": "fixed", + "count": 5, + "interval": "PT20S" + } + } + }, + "Update_a_row_-_Approval_Requests": { + "runAfter": { + "Add_a_new_row_-_Approval_Response": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "203ed7ea-def1-4f76-953b-b0273e3ef2e0" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_commondataserviceforapps_1", + "operationId": "UpdateRecord", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps" + }, + "parameters": { + "entityName": "msdyn_flow_approvalrequests", + "recordId": "@outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approvalid']", + "item/msdyn_flow_approvalrequest_stage": 192351000, + "item/statuscode": 1 + }, + "authentication": "@parameters('$authentication')", + "retryPolicy": { + "type": "fixed", + "count": 5, + "interval": "PT20S" + } + } + }, + "Get_Flow_Approvals": { + "runAfter": { + "Update_a_row_-_Approval_Requests": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "240bae5b-2286-48d6-b62f-561a6bf0dac5" + }, + "type": "OpenApiConnection", + "inputs": { + "host": { + "connectionName": "shared_commondataserviceforapps_1", + "operationId": "ListRecords", + "apiId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps" + }, + "parameters": { + "entityName": "msdyn_flow_flowapprovals", + "$filter": "msdyn_flow_flowapprovalid eq '@{outputs('Get_a_row_by_ID_-_Approvals')?['body/msdyn_flow_approvalid']}'" + }, + "authentication": "@parameters('$authentication')", + "retryPolicy": { + "type": "fixed", + "count": 5, + "interval": "PT20S" + } + } + } + }, + "runAfter": { + "Parse_JSON_-_Approvals": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "60401d54-a2bc-424d-b479-331041b5937f" + }, + "type": "Foreach", + "runtimeConfiguration": { + "concurrency": { + "repetitions": 20 + } + } + }, + "Response_-_Success": { + "runAfter": { + "Apply_to_each": [ + "Succeeded" + ] + }, + "metadata": { + "operationMetadataId": "ff18241c-754d-4a9a-a057-1f8db813a5a5" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 200, + "body": { + "status": "OK" + }, + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + } + } + } + } + }, + "Response_-_Failed": { + "runAfter": { + "Apply_to_each": [ + "Failed", + "TimedOut" + ] + }, + "metadata": { + "operationMetadataId": "90c4eb02-b830-4dd0-8a20-2cf5811bd1df" + }, + "type": "Response", + "kind": "Http", + "inputs": { + "statusCode": 500, + "body": { + "status": "Failed" + }, + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string" + } + } + } + } + } + } + }, + "templateName": "" + }, + "schemaVersion": "1.0.0.0" +} \ No newline at end of file diff --git a/samples/manage-approvals/sourcecode/Workflows/Setapprovalresult-E698FD41-5D76-EE11-8179-0022489FD9DD.json.data.xml b/samples/manage-approvals/sourcecode/Workflows/Setapprovalresult-E698FD41-5D76-EE11-8179-0022489FD9DD.json.data.xml new file mode 100644 index 00000000..845dc8ad --- /dev/null +++ b/samples/manage-approvals/sourcecode/Workflows/Setapprovalresult-E698FD41-5D76-EE11-8179-0022489FD9DD.json.data.xml @@ -0,0 +1,26 @@ + + + /Workflows/Setapprovalresult-E698FD41-5D76-EE11-8179-0022489FD9DD.json + 1 + 0 + 5 + 0 + 4 + 0 + 0 + 0 + 0 + 0 + 1 + 2 + 1 + 1 + 1.0.0.0 + 1 + 0 + 1 + none + + + + \ No newline at end of file