Archive

Archive for the ‘PowerApps’ Category

Power Apps – Environment variables and their usage in Canvas Apps

February 18, 2020 Leave a comment

Lets take a scenario, where you would want to pass a 3rd party API URL to your plug-in which changes every quarter. Couple of options to pass the URL to plug-in are either pass the URL as ‘Secured/Unsecured parameters’ or Create an entity and store the API URL and fetch from plug-in using Query Expression.

Using ‘Environment variables’, which is Power Apps preview feature currently, we can configure the input parameters allow management of data separately compared to hard-coding values.

Up on creating ‘Environment variable’, a new record gets added to both OOB ‘Environment Variable Definition’ entity and ‘Environment Variable Values’ entities.

‘Environment Variable Values’ is child to the ‘Environment Variable Definition’ entity.

We can refer records from these OOB entities in plug-ins or Canvas Apps or Power Automate just like any other entities.

In this article, lets see how to create ‘Environment Variables’ and use them in Canvas App.

Prerequisites:

  • Subscribe to 30 days trial and get Office 365 account.
  • Connect to Power Apps maker portal using Office 365 account.

Create a new ‘Environment variable’:

  • From Power Apps maker portal go to ‘Solutions’ tab.
  • Either create a new solution/Open Existing solution.
  • From ribbon, click on New -> Environment variable
    • In the ‘New environment variable’ pane, provide ‘Display Name’ and choose ‘Data Type’.
    • Provide either ‘Default Value’ or ‘Current Value’

EV_1

  • Save. I’ve created a ‘Text’ variable with an environment URL as ‘Current Value’.

EV_2

  • I’ve configured a Model driven app with ‘Environment Variable Definition’ entity added to the ‘Site Map’ to check the created ‘Environment variable’ record.

EV_3

  • Open the Model driven app and go to ‘Environment Variable Definition’ and you will see the record.

EV_4

Using ‘Environment variable’ in Canvas app:

As the ‘Environment variable’ stores in ‘Environment Variable Definition’ and ‘Environment Variable Values’ entities, we can add these entities from ‘Data sources’.

  • Create a new Canvas App.
  • Add ‘Environment Variable Definitions’ and ‘Environment Variable Values’ entities as Data sources.

EV_6

  • Add a Label to display the ‘Environment variable’ value.
  • Use ‘LookUp’ function to get the specific ‘Environment variable’ filtered by ‘Display Name’.
    • LookUp(‘Environment Variable Values’,’Environment Variable Definition’.’Display Name’=”AppURL”).Value
    • In the above formula, ‘AppURL’ is my ‘Environment Variable’ display name.
  • The value would be fetched and set to the Label text.

EV_7

Managing ‘Environment variables’:

  • Environment variables can be created and managed through the modern solution interface or by using code.
  • A separate JSON file is created within your solution package for the values, which can also be managed in source control and modified in a build pipeline.
  • When you export the solution, a json file ‘environment_variable_values’ will be available.

EV_8

  • Open the file and the ‘Environment Variables’ render as json records.

EV_9

  • Export to and import from Excel is also supported.

🙂

 

 

 

PowerApps Portal – Enable Maintenance mode

February 13, 2020 Leave a comment

During a scheduled maintenance or due to a temporary outage, If you want to bring down your portal and display a proper message to users, PowerApps portal has “Enable Maintenance mode” option.

In this article lets see how to use ‘Enable Maintenance mode’ option.

Prerequisites:

  • Subscribe to 30 days trial and procure an Office 365 account.

Steps to navigate to Portals admin center:

  • Connect to Power Apps maker portal using Office 365 account.
  • Create a new PowerApps portal app, if you don’t have already.

PPortal_Maintainence_6

  • Now from the ‘Apps’ tab, select your portal and go to ‘Settings’.

PPortal_Maintainence_2

  • From the ‘Portal settings’ pane, click on ‘Administration’ link.

PPortal_Maintainence_1

  • You will be redirected to ‘PowerApps Portals admin center’.

PPortal_Maintainence_3

Enable/disable Maintenance mode:

  • Select ‘Portal Actions’ tab and click on ‘Enable maintenance mode’

PPortal_Maintainence_4

  • You get the ‘Enable maintenance mode’ popup.

PPortal_Maintainence_5

  • Under Select page to be used when maintenance mode is enabled: Select one of the following values:
    • Default page: Select this value if you want the default page to be displayed. By default, this option is selected.
    • Custom page: Select this value if you want a custom HTML page to be displayed.
      • Custom page URL: You must ensure that the page URL you provide is publicly accessible. 
  • I opted ‘Default page’ option and clicked on ‘Enable’.
  • If you browse the portal, you would get following screen:

PPortal_Maintainence_7

Notes:

  • When the maintenance mode is enabled, the customers are restricted from browsing any webpages except the <portal URL>/_services/about page.
  • If you opt for ‘Custom page’ option, make sure, the custom page you provided should not contain the x-frame-options:SAMEORIGIN response header, else the page will not load.

🙂

 

Power Platform – Pass external API collection from Power Automate to Canvas App

February 9, 2020 1 comment

In this article, lets see how to pass an external API’s json collection from Power Automate(Formerly ‘Microsoft Flow’) to a Canvas application.

For this example, I am going to use ESRI  mapping service API, in my Power Automate Flow. Refer here to know more about ESRI. You may also use other APIs as per your convenience.

ESRI API is url based and returns the ‘Address Suggestions’ in json format.

Flow_Json_3

Before we start lets make sure to meet all the prerequisites.

Prerequisites:

  • Subscribe to 30 days trial and get Office 365 account.
  • Connect to Power Automate portal using Office 365 account to build Power Automate flow.
  • Connect to Power Apps maker portal using Office 365 account to build the Canvas App.
  • ESRI api URL – Refer my previous article on the usage of ESRI or you can simply use this url

Once all prerequisites are met, here is the high level design:

  • Create a new Power Automate flow and call ESRI API to fetch Address Suggestions.
    • You can take any open API which returns json collection.
  • Parse the ESRI API Response to json collection.
  • Create a new Canvas app
  • Trigger Power automate flow from Canvas App and read the collection.

Lets get started.

Steps to configure the Power Automate Flow:

  • Connect to Power Automate portal
  • Create a new ‘Instant flow’ by selecting the right Environment.

Flow_Json_1

  • Provide a name ‘GetAddressSuggestions’ and select trigger as ‘PowerApps’

Flow_Json_2

  • To call ESRI api, add a new ‘HTTP’ action.

Flow_Json_4

  • Choose Method as ‘GET’ and in URI paste the ESRI url as mentioned in prerequisite section.

Flow_Json_5

  • Next, we need to parse the response from ESRI api. As the ESRI results would be in json format, add ‘Parse JSON’ action.

Flow_Json_6

  • In ‘Parse JSON’ action,
    • set Content as ‘Body’ from HTTP action.
    • Next we need to provide the json schema of ESRI response. To do that, click on ‘Generate from sample’.
    • Flow_Json_9
    • Now copy the response from ESRI API (Copy the browser’s output using ctrl+a+copy)
    • Flow_Json_7
    • Paste in the ‘Insert a sample JSON Payload’ window and click ‘Done’.
    • Flow_Json_8
    • If no warnings, your ‘Parse JSON’ pane should look as below.
    • Flow_Json_10
  • As we completed the ESRI response capture and parsing to json, now we need to pass the captured json response to Power App.
  • To pass the json response to Power App, add a new ‘Response’ action.

Flow_Json_11

  • In the ‘Response’ pane,
    • Set the ‘Body’ to ‘Body’ from ‘Parse JSON’.
    • Flow_Json_12
    • Expand ‘Show advanced options’ and click on ‘Generate from sample’.
    • Copy the response from ESRI API and paste in the ‘Insert a sample JSON Payload’ window and click ‘Done’. (Same step like we did in ‘Parse JSON’ pane).
    • ‘Response’ pane should look as below with no warnings.
    • Flow_Json_13
  • Run the flow and make sure it ran successfully.

Flow_Json_18

Steps to configure the Canvas App:

As we completed the Power Auto Flow, now its time to consume the Power Automate flow response from Canvas App by following the steps below

  • Connect to Power Apps maker portal using the same Office 365 account.
  • Create a new Canvas App.
    • Note: Make sure the same Environment used for Power Automate is selected.
  • Add a new button.
  • Select the button, from the ribbon menu, click on ‘Action -> Power Automate’.
  • From the pane select the ‘GetAddressSuggestions’ Power app flow.

Flow_Json_14

  • After few seconds, you would see the Run() command auto populated as below.

Flow_Json_15

  • As we going to get json collection from flow, lets capture the json collection to a collection variable ‘collAddress’ using ‘ClearCollect()’. Refer article to know more about ‘ClearCollect()’.
  • With the ClearCollect() and Run() functions, the final ‘OnSelect’ statement should look as below.

Flow_Json_16

  • Lets run the App and click on the button. Application takes couple of minutes to complete the run.

Flow_Json_17

  • Post run, check the collection returned from flow by going to ‘File -> Collections’ tab.

Flow_Json_19

  • You can also add a ‘Data table’ control and display the results returned from flow as below

Flow_Json_20

🙂

 

Power Platform – Pass json collection from Canvas App to Power Automate

February 9, 2020 1 comment

Refer my previous article for steps to pass json collection from Power Automate to Canvas App.

Now lets see how to pass json collection from a Canvas app to Power Automate flow.

Before we start lets make sure to meet all the prerequisites.

Prerequisites:

  • Subscribe to 30 days trial and get Office 365 account.
  • Connect to Power Automate portal using Office 365 account to build Power Automate flow.
  • Connect to Power Apps maker portal using Office 365 account to build the Canvas App.

Once all prerequisites are met, here is the high level design:

  • Create a new Canvas app.
  • Prepare a json collection.
  • Create a new Power Automate flow.
  • Trigger Power automate flow from Canvas App by passing the collection as parameter.
  • Read the json collection from Power Automate flow.
  • Create ‘Contact’ records in CDS.

Lets get started.

Steps to configure Canvas App:

  • Connect to Power Apps maker portal using the Office 365 account.
  • Create a new Canvas App.
    • Note: Make sure the same Environment used for Power Automate is selected.
  • Add a new button ‘Generate Sample Collection’.
  • On button’s ‘OnSelect’ prepare a json collection using ‘ClearCollect’ function as below.

Flow_Json_21

  • Once your run the App and click ‘Generate Sample Collection’ button, you should see the collection from ‘File -> Collections’ tab.

Flow_Json_22

Steps to configure the Power Automate Flow:

  • Connect to Power Automate portal using the same office 365 credentials used to connect to Power App portal.
  • Create a new ‘Instant flow’ by selecting the right Environment.

Flow_Json_1

  • Provide a name ‘GetCollectionFromPowerApp’ and select trigger as ‘PowerApps’.
  • Now, we need to read the collection passed from Canvas app to a variable. Lets add a new ‘Initialize Variable’ action.
  • In the ‘Initialize Variable’ action,
    • Provide variable name by setting ‘Name’ field. I set it as ‘collPersons’.
    • Type: String
    • Select ‘Value’ and click on ‘Ask in PowerApps’. A auto generated name would appear and select the same.
    • Flow_Json_25
  • Once we receive the collection and stored in a string variable ‘collPersons’, next we need to parse in to json collection.
  • Add a new ‘Parse JSON’ action.
  • In ‘Parse JSON’ action,
    • set Content as ‘collPersons’ from ‘Initialize Variable’ action.
    • Next we need to provide the json schema coming from Canvas app. To do that, click on ‘Generate from sample’.
    • Copy the json collection formed in Canvas app using ClearCollect function and paste as below.
    • Flow_Json_27
    • If no warnings, your ‘Parse JSON’ pane should look as below.
    • Flow_Json_28
  • Now we got json collection parsed and we are good start final step, creating records to CDS.
  • Add ‘Create a new record’ CDS action and select the ‘Environment’ and ‘Entity Name’

Flow_Json_33

  • Set the attributes (Last Name and Email) from ‘Parse JSON’ action.

Flow_Json_34

  • Once you set variables in ‘Create a new record’ CDS action, flow would automatically wrap the action in ‘Apply to each’.

Flow_Json_29

Trigger the Power automate flow from Canvas App:

Now we have Power automate flow with the logic to read and parse the json collection and add them to CDS as Contact records, lets trigger the flow from Canvas App.

  • Open the Canvas app created in above sections.
  • Add a new button ‘Share Collection To Flow’
  • Select the button, from the ribbon menu, click on ‘Action -> Power Automate’.
  • From the pane select the ‘GetCollectionFromPowerApp’ Power app flow.
  • After few seconds, you would see the Run() command auto populated. Now pass the ‘collPersonalInfo’ collection wrapped in JSON() function.
    • JSON() function is required to convert the ‘collPersonalInfo’ collection to JSON string as the Power Automate flow expects ‘String’ variable as first action.
  • Finally ‘OnSelect’ should look as below.

 

Flow_Json_30

  • Now run the App and click ‘Share Collection To Flow’ button, post run, go to Power automate flow’s history and you should see it ran successfully.

Flow_Json_31

🙂

Categories: CRM, PowerApps Tags: ,

‘Failed during http send request’ error – Triggering Power automate from Canvas App

February 9, 2020 Leave a comment

While configuring Canvas app for my previous article ,I encountered following error while selecting ‘Power Automate’ from Canvas app.

Flow_Json_23

Reason:

  • In my ‘Power Automate’, I was reading collection received from Canvas app to ‘Array’ type variable.

Flow_Json_24

  • There seems to be issue with ‘Array’ datatype when triggering ‘Power Automate’ flow Canvas App.

Fix:

  • In the Power Automate, changed the Type from ‘Array’ to ‘String’ and used ‘Parse JSON’ action to convert String to json collection.

Flow_Json_25

  • In Canvas App, used JSON() function to convert the Collection to json string.

Flow_Json_30

🙂

Power platform 2020 release wave 1 – Plan and features list

February 7, 2020 Leave a comment

The Power Platform release plan (formerly release notes) for the 2020 release wave 1 has been published with great new features.

Refer here for the details and download from here for the full list of features.

Following are the standout features for me:

  • Canvas apps:
    • Monitor tool – Allow makers to diagnose and troubleshoot their applications quicker
    • Create an app from data in a landscape format instead of just a phone layout.
  • Model Driven Apps:
    • Edit/Create related records without navigating away – Users do not have to navigate away from a form to create or edit a related record

PAPP_Wave2020_2

  • Power app Portal:
    • Web APIs for CRUD operations on Common Data Service entitiesThis is much awaited feature as former portal versions would only allow Read outside of ‘Entity Forms’ using Liquid script.
    • Power BI Embedded component in portal designerPortal provides the first party integration with Power BI by using the liquid tags
    • Simplified themes in portals Studio
    • Support for additional entities in global searchNow you can enable Global Search on Custom entities as well using a ‘Site Setting’ configuration.

PAPP_Wave2020_1

  • Power Automate:
    • Solutioning support for UI flowsWith this feature, you can create your UI flows in solutions, easily export them into a package, and then import them across different environments for your ALM needs.
    • Azure integration with Power AutomateOption to create flows by using a template from the Azure portal
    • Copy and paste in Power AutomateIf you want to duplicate actions in the Power Automate designer, you can now copy and paste them.
    • UI FlowsWith UI flows in Power Automate, you can record mouse clicks, keyboard use, and data entry to automate manual, repetitive, and time-consuming tasks to improve workplace productivity
  • Power Virtual Agent:
    • Add a Power Virtual Agents bot into Power Apps canvas app.
    • Add images and videos to topics.

🙂

 

Power Apps – Custom help panes and guided tasks

February 2, 2020 Leave a comment

Custom help panes and guided tasks gives your Unified Interface application a custom in-product help experience that is tailored to your organization.

Custom help panes replace the previous learning path guided learning feature used with legacy web client apps.

How to enable Custom help panes and guided tasks:

  • Open your Power App
  • Using ‘Advanced Settings’, Go to Settings -> Administration

GuideTasks_8

  • Choose “Custom help panes and guided tasks” to ‘Yes’

GuideTasks_1

Configuring Help pane content:

In my example, I am using ‘Fund Raisers’ Model driven app. To configure ‘Help pane content’ for ‘Fundraiser’ entity:

  • Select the ‘Fundraisers’ from the Sitemap.
  • Click on ‘?‘ and from the ‘Help Pane’, select ‘Edit’ option as shown below.

GuideTasks_2

  • Using the Rich text editor, you can configure the rich content.
  • Use ‘Balloon’ option to point to specific UI elements with text.

GuideTasks_4

  • To add ‘Balloon’ on ‘Delete’ button, use ‘Drag to an element‘ option and point to the ‘Delete’ button.

GuideTasks_3

  • Once configured, Balloon would show up as below

GuideTasks_5

  • You can also add Images, Links and Videos.

Moving Help content via Solutions:

  •  If you want to move your content to another environment, first add your existing help pages into an unmanaged solution before you export them.
  • From the ‘Add Exisitng’ components, select ‘Help Page’.

GuideTasks_6

  • Select the available ‘Help content’ records and add to the Solution.

GuideTasks_7

Who can author help pane content:

  • By default, System Administrator and System Customizer security roles both have this privilege.
  • For other security roles, grant Global create, read, write, delete, append, and append to permissions on the Help Page privilege.

Notes:

  • To author custom help panes, you need to be on version 9.1.0.10300 or later.
  • You can enable custom help panes or customizable help, but not both at the same time.
  • Each help pane is unique for these contexts: Application, Entity, Form, Language

Refer here for more details.

🙂