Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New PR #77

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added samples/manage-approvals/.DS_Store
Binary file not shown.
79 changes: 79 additions & 0 deletions samples/manage-approvals/README.md
Original file line number Diff line number Diff line change
@@ -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/)


Binary file added samples/manage-approvals/assets/preview01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/manage-approvals/assets/preview02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/manage-approvals/assets/preview03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/manage-approvals/solution/.DS_Store
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<CanvasApp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>gk_manageapprovalsapp_efeb3</Name>
<AppVersion>2023-11-12T12:18:47Z</AppVersion>
<Status>Ready</Status>
<CreatedByClientVersion>3.23105.17.0</CreatedByClientVersion>
<MinClientVersion>3.23105.17.0</MinClientVersion>
<Tags>{"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"}</Tags>
<IsCdsUpgraded>0</IsCdsUpgraded>
<GalleryItemId xsi:nil="true"></GalleryItemId>
<BackgroundColor>RGBA(0,176,240,1)</BackgroundColor>
<DisplayName>Manage Approvals App</DisplayName>
<Description xsi:nil="true"></Description>
<CommitMessage xsi:nil="true"></CommitMessage>
<Publisher xsi:nil="true"></Publisher>
<AuthorizationReferences>[]</AuthorizationReferences>
<ConnectionReferences>{"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"}}</ConnectionReferences>
<DatabaseReferences>{"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"}}}}</DatabaseReferences>
<AppComponents>[]</AppComponents>
<AppComponentDependencies>[]</AppComponentDependencies>
<CanConsumeAppPass>1</CanConsumeAppPass>
<CanvasAppType>0</CanvasAppType>
<BypassConsent>0</BypassConsent>
<AdminControlBypassConsent>0</AdminControlBypassConsent>
<EmbeddedApp xsi:nil="true"></EmbeddedApp>
<IntroducedVersion>1.0</IntroducedVersion>
<CdsDependencies>{"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}]}</CdsDependencies>
<IsCustomizable>1</IsCustomizable>
<BackgroundImageUri>/CanvasApps/gk_manageapprovalsapp_efeb3_BackgroundImageUri</BackgroundImageUri>
<DocumentUri>/CanvasApps/gk_manageapprovalsapp_efeb3_DocumentUri.msapp</DocumentUri>
</CanvasApp>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name LocalizedName="Approval" OriginalName="Approval">msdyn_flow_approval</Name>
<RibbonDiffXml />
</Entity>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<RibbonDiffXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RibbonNotSupported />
</RibbonDiffXml>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name LocalizedName="Approval Request" OriginalName="Approval Request">msdyn_flow_approvalrequest</Name>
<RibbonDiffXml />
</Entity>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<RibbonDiffXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RibbonNotSupported />
</RibbonDiffXml>
27 changes: 27 additions & 0 deletions samples/manage-approvals/sourcecode/Other/Customizations.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Entities />
<Roles />
<Workflows />
<FieldSecurityProfiles />
<Templates />
<EntityMaps />
<EntityRelationships />
<OrganizationSettings />
<optionsets />
<CustomControls />
<EntityDataProviders />
<CanvasApps />
<connectionreferences>
<connectionreference connectionreferencelogicalname="ggk_MicrosoftDataverseManageApprovals">
<connectionreferencedisplayname>Microsoft Dataverse - Manage Approvals</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps</connectorid>
<iscustomizable>1</iscustomizable>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
</connectionreferences>
<Languages>
<Language>1033</Language>
</Languages>
</ImportExportXml>
137 changes: 137 additions & 0 deletions samples/manage-approvals/sourcecode/Other/Solution.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml version="9.2.23103.244" SolutionPackageVersion="9.2" languagecode="1033" generatedBy="CrmLive" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SolutionManifest>
<UniqueName>Manage_Approvals</UniqueName>
<LocalizedNames>
<LocalizedName description="Manage Approvals" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Version>1.0.0.0</Version>
<Managed>0</Managed>
<Publisher>
<UniqueName>GabrielKoolman</UniqueName>
<LocalizedNames>
<LocalizedName description="Gabriel Koolman" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<EMailAddress xsi:nil="true"></EMailAddress>
<SupportingWebsiteUrl xsi:nil="true"></SupportingWebsiteUrl>
<CustomizationPrefix>gk</CustomizationPrefix>
<CustomizationOptionValuePrefix>12276</CustomizationOptionValuePrefix>
<Addresses>
<Address>
<AddressNumber>1</AddressNumber>
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
<Address>
<AddressNumber>2</AddressNumber>
<AddressTypeCode>1</AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode>1</ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
</Addresses>
</Publisher>
<RootComponents>
<RootComponent type="1" schemaName="msdyn_flow_approval" behavior="2" />
<RootComponent type="1" schemaName="msdyn_flow_approvalrequest" behavior="2" />
<RootComponent type="29" id="{e698fd41-5d76-ee11-8179-0022489fd9dd}" behavior="0" />
<RootComponent type="300" schemaName="gk_manageapprovalsapp_efeb3" behavior="0" />
</RootComponents>
<MissingDependencies>
<MissingDependency>
<Required type="1" schemaName="msdyn_flow_approval" displayName="Approval" solution="msdyn_FlowApprovalsCore (2.0.4.8)">
<package>msdyn_FlowApprovals (2.0.4.8)</package>
</Required>
<Dependent type="1" schemaName="msdyn_flow_approval" displayName="Approval" />
</MissingDependency>
<MissingDependency>
<Required type="1" schemaName="msdyn_flow_approval" displayName="Approval" solution="msdyn_FlowApprovalsCore (2.0.4.8)">
<package>msdyn_FlowApprovals (2.0.4.8)</package>
</Required>
<Dependent type="29" displayName="Set approval result" id="{e698fd41-5d76-ee11-8179-0022489fd9dd}" />
</MissingDependency>
<MissingDependency>
<Required type="1" schemaName="msdyn_flow_approval" displayName="Approval" solution="msdyn_FlowApprovalsCore (2.0.4.8)">
<package>msdyn_FlowApprovals (2.0.4.8)</package>
</Required>
<Dependent type="300" schemaName="gk_manageapprovalsapp_efeb3" displayName="Manage Approvals App" />
</MissingDependency>
<MissingDependency>
<Required type="1" schemaName="msdyn_flow_approvalrequest" displayName="Approval Request" solution="msdyn_FlowApprovalsCore (2.0.4.8)">
<package>msdyn_FlowApprovals (2.0.4.8)</package>
</Required>
<Dependent type="1" schemaName="msdyn_flow_approvalrequest" displayName="Approval Request" />
</MissingDependency>
<MissingDependency>
<Required type="1" schemaName="msdyn_flow_approvalrequest" displayName="Approval Request" solution="msdyn_FlowApprovalsCore (2.0.4.8)">
<package>msdyn_FlowApprovals (2.0.4.8)</package>
</Required>
<Dependent type="29" displayName="Set approval result" id="{e698fd41-5d76-ee11-8179-0022489fd9dd}" />
</MissingDependency>
<MissingDependency>
<Required type="1" schemaName="msdyn_flow_approvalrequest" displayName="Approval Request" solution="msdyn_FlowApprovalsCore (2.0.4.8)">
<package>msdyn_FlowApprovals (2.0.4.8)</package>
</Required>
<Dependent type="300" schemaName="gk_manageapprovalsapp_efeb3" displayName="Manage Approvals App" />
</MissingDependency>
<MissingDependency>
<Required type="1" schemaName="msdyn_flow_approvalresponse" displayName="Approval Response" solution="msdyn_FlowApprovalsCore (2.0.4.8)">
<package>msdyn_FlowApprovals (2.0.4.8)</package>
</Required>
<Dependent type="29" displayName="Set approval result" id="{e698fd41-5d76-ee11-8179-0022489fd9dd}" />
</MissingDependency>
<MissingDependency>
<Required type="1" schemaName="msdyn_flow_flowapproval" displayName="Flow Approval" solution="msdyn_FlowApprovalsCore (2.0.4.8)">
<package>msdyn_FlowApprovals (2.0.4.8)</package>
</Required>
<Dependent type="29" displayName="Set approval result" id="{e698fd41-5d76-ee11-8179-0022489fd9dd}" />
</MissingDependency>
</MissingDependencies>
</SolutionManifest>
</ImportExportXml>
Loading
Loading