Archive

Archive for the ‘PowerApps’ Category

Canvas App | Dataverse | Distribute columns to multiple forms and Patch

January 18, 2021 Leave a comment

When working with large tables in Canvas App’s Phone layout Forms, it would be counterintuitive to place all the fields in a single form. In below screen, user has to scroll a lot to fill all the details.

In this article, lets see how we can simplify above screen by distributing fields in multiple forms and finally use the Patch function to save the information in to Dataverse from all the forms.

I am taking the OOB ‘Contact’ table in this scenario and distributing fields in to 3 screens (i.e., Basic Details, Contact Details and Additional Details). Lets get started.

  • Create a new Canvas App from Maker portal.
  • From the ‘Data’ tab, Select ‘Entities -> Current environment -> Contacts’ table and add to the App.
  • Add 3 screens (Basic Details, Contact Details and Additional Details) to distribute fields.
  • In the Basic Details screen (i.e., scrBasicDetails), add a new Form (i.e.,formBasicInfo) and add following fields from ‘Contact’ Datasource.
  • Add a Button, to navigate to next screen (i.e., scrContactDetails). Add following formula on ‘OnSelect’ of button.
  • Similarly, In the Contact Details screen (i.e., scrContactDetails) add a new Form (i.e.,formContactDetails) and add following fields from ‘Contact’ Datasource.
  • Add a Button, to navigate to next screen (i.e., scrAddlDetails) by triggering ‘Navigate’ function on ‘OnSelect’ of button.
  • In the last ‘Additional Details’ (i.e., scrAddlDetails) screen, add a new Form (i.e.,formAddlDetails) and add ‘Attachments’ field to capture and store documents to Dataverse.
  • Since this is our final screen, Add a Button to Submit the data to Contact table in Dataverse using following ‘Patch’ function.
  • Post submit refresh the forms using NewForm() function.
  • Display a banner message using ‘Notify’ function.
  • Finally Navigate back to first screen (i.e., scrBasicDetails) using Navigate() function.
  • Combined formula is as below.
// Patch : Use Patch with the Defaults function to create records.
// form.Updates : Gets the data from the fields presented on the from.
Patch(
    Contacts,
    Defaults(Contacts),
    formBasicInfo.Updates,
    formContactDetails.Updates,
    formAddlDetails.Updates
);
// NewForm : Sets the form mode to Insert so that you can submit a new Contact.
NewForm(formBasicInfo);
NewForm(formContactDetails);
NewForm(formAddlDetails);
// Notify : Display notification
Notify(
    "Contact submitted successfully",
    NotificationType.Success
);
// Navigate : Navigates to first screen
Navigate(scrBasicDetails);
  • Run the App, provide details and navigate to next screen and upload images and finally click ‘Submit’ to save data to Dataverse.
Combined screenshot of 3 forms
  • Now go to Dataverse using Model Driven App and open the Contact -> Audit History, to prove only one transaction triggered with our Patch function.

🙂

Categories: PowerApps Tags: , , ,

[Step by Step] Canvas App | Dataverse | Filter, Patch, For All, Lookup

January 3, 2021 2 comments

In this article, lets understand the Filter, Patch, For All and more functions and formulas using following ‘Car and Customer’ scenario. I will be using Dataverse formerly CDS as Data Source.

  • Create a ‘Manufacturer’ table to store Car manufactures.
  • Use OOB ‘Contact’ table to store Customers.
  • Create a ‘Cars’ table to store Cars.
    • Configure ‘Contact’ and ‘Manufacturer’ look ups in ‘Cars’ table.

Lets proceed first by understanding ‘Data Model’ and then with creating ‘Canvas’ App.

Dataverse Data Model:

  • ‘Cars’ form with ‘Manufacturer’ and ‘Customers’ look up.
  • ‘Cars’ view.

Configuring Canvas App

Lets build the Canvas App, with following features:

  • Add “Manufacturers”, “Cars” and “Contact” (i.e., Customer) Data Sources.
  • Add ‘combManufacture’ Combo box to show ‘Active’ Manufacturers.
    • Select ‘Data source’ as ‘Manufacturers’.
    • Select ‘Active Manufacturers’ from the ‘Views’.
  • Add ‘combCustomers‘ Combo box to show ‘Active’ Customers (i.e., Contacts).
    • Select ‘Data source’ as ‘Contacts’.
    • Select ‘Active Contacts’ from the ‘Views’.
  • Filter the ‘Cars’ by selected ‘Manufacturer’ and set to ‘collCars’ collection variable.
    • Formula : ClearCollect(collCars,Filter(Cars,Manufacturer.Manufacturer=combManufacture.Selected.Manufacturer));
  • Add ‘galCars’ Gallery control and select the ‘Data Source’ as the collection variable from previous step.
  • In the Gallery, add a ‘Checkbox’ control to enable selection and a Label to show the ‘Customer’.
  • On check of ‘Checkbox’ add the selected ‘Car’ to ‘selCars’ collection variable, using ‘OnCheck’ event.
    • Formula : Collect(selCars, ThisItem);
  • On uncheck of ‘Checkbox’ remove the selected ‘Car’ from ‘selCars’ collection variable, using ‘OnUncheck’ event.
    • Formula: Remove(selCars, ThisItem);
  • Add ‘Set Owner’ button to map the selected Cars and Customer.
    • First move the selected ‘Cars’ from ‘selCars’ collection to ‘tempCollection‘ by renaming ‘Primary’ column to “ID” using RenameColumns function.
    • Use ForAll function to loop through ‘tempCollection‘ (i.e., Selected Cars) and update the ‘Contact’ lookup with ‘combCustomers‘ selected record using Patch function.
    • Reset the Cars Gallery(i.e., Reset(galCars)) to refresh.
    • Display the message using Notify function.
    • Clear the collection variables.
    • Formula: ClearCollect(tempCollection,RenameColumns(selCars,”crbb8_carid”,”ID”));ForAll(tempCollection,Patch(Cars,LookUp(Cars,Car=ID),{Contact:combCustomers.Selected}));Reset(galCars);Notify(“Update Successful..”,NotificationType.Success);Clear(tempCollection);Clear(selCars);
  • Add ‘Clear Owner’ button to unmap the selected Cars and Customer.
    • To unmap the Customer with Car, clear ‘Contact’ look up by setting ‘Blank()’ function (i.e., {Contact:Blank()}).
    • Use ‘For All’ and ‘Patch’ functions as above to update the record.
    • Formula : ClearCollect(tempCollection,RenameColumns(selCars,”crbb8_carid”,”ID”));ForAll(tempCollection,Patch(Cars,LookUp(Cars,Car=ID),{Contact:Blank()}));Reset(galCars);Notify(“Update Successful..”,NotificationType.Success);
  • Now run the App and you should see screen as below.

Refer this article for PowerApps functions and formulas.

🙂

Categories: PowerApps Tags: , ,

Power Apps | Unable to query Canvas App using CDS WebAPI

September 27, 2020 Leave a comment

In my Power Apps Environment I have the following ‘Hello World’ Canvas App.

When I query ‘Canvas App’ entity using Web API from same Environment, there were no Canvas App records returned.

Reason:

  • If you create a Canvas App from ‘Apps’ tab outside of solutions or imported any App to the Environment, Canvas App will not be available in CDS until its added to a solution.
  • Open any of the unmanaged solution from the Environment, use ‘Add Existing’ and select the ‘Hello World’ Canvas App from ‘Outside solutions’ tab.
  • Once added a ‘Name’ gets populated and looks as below.
  • Now query the ‘Canvas App’ entity using Web API and now we should get the ‘Hello World’ Canvas App record.

🙂

Categories: PowerApps Tags: ,

Power Platform Admin Analytics

September 27, 2020 Leave a comment

In previous Dynamics versions, with the help of Organization Insights, available as a preferred solution from AppSource, we can get the organization level insights such as No of Active Users, API Calls, etc.

Now  these analytics can be viewed right from the Power Platform Admin Center with no need of additional solutions.

Currently there are 3 types of Analytics are available.

Who can view the Analytics reports:

Admins with the following roles and a license can view the analytics:

  • Environment Admin – can view reports for the environments that the admin has access to.
  • Power Platform admin – can view reports for all environments.
  • Dynamics 365 admin – can view reports for all environments.
  • Microsoft 365 Global admin – can view reports for all environments.

Refer this article for more details

🙂

Categories: CRM, PowerApps Tags: ,

Microsoft Teams and PowerApps – Project Oakdale

September 24, 2020 1 comment

Project Oakdale, a new built-in low-code data platform for Teams that provides enterprise relational datastores with rich data types to Teams users, is now in public preview.

Solutions built with Power Platform can be easily published to the Teams app store and can be used off the shelf or customized for specific needs.

Lets see how to embed a Power app in Teams.

  • Connect to Office 365 portal and check if you have ‘Teams’ enabled.
  • If no Teams available, go to Teams site and sign in with Office 365 credentials.
  • Go to Teams and click on Apps->Power Apps and click ‘Add’.
  • A ‘Power Apps’ tab adds to the Teams.
  • From ‘Power Apps’ , either create a new App by clicking ‘Create an app’ or pick any of the readily available apps.
  • Once you choose existing App, select a Team’s Channel where this App needs to be available. I chose ‘Hello World’ team’s ‘General’ channel.
  • App takes few minutes to complete the setup.
  • Grant the required permissions.
  • App loads as below and ready to be used.

Notes:

  • Project Oakdale environments are automatically created for the selected team when you create a Power app in Teams for the first time or install a Power Apps app from the app catalog. See About the Project Oakdale environment.

🙂

Categories: PowerApps Tags: ,

Power Apps | Custom connector | User does not have an entitlement to use PowerApps

September 2, 2020 Leave a comment

From the Dynamics trial instance, while registering a Custom Connector, encountered following issue.

Reason:

  • Error message states clearly, that the User who is trying to register ‘Custom Connector’ does not have ‘Power Apps’ license.
  • By default when you subscribe for trial , Dynamics only grants the ‘Dynamics 365 Customer Engagement Applications’ license which does not have ‘Power Apps’ option.
  • To check the User license, connect to Microsoft 365 Admin Center
  • Go to user’s ‘Manage product licenses’ tab.

Fix:

  • Grant the user Power Apps license to the user.
  • One option is by subscribing for the ‘Dynamics 365 Customer Engagement Plan‘ license by following below steps.
  • Connect to Microsoft 365 Admin Center
  • Go to ‘Billing -> Purchasing Services’.
  • Select ‘Dynamics 365 Customer Engagement Plan Trial’ and click on ‘Get free trial’.
  • You would get following confirmation page up on procurement.
  • Now open the User, and grant the ‘Dynamics 365 Customer Engagement Plan’ license.
    • Make sure ‘PowerApps for Dynamics 365’ is enabled.
  • You should be able to configure Custom Connector now.
  • Refer Power Apps license guide for more details.

🙂

Categories: PowerApps Tags: ,

Power apps – Model driven app – Excel import not working

Other day, when we copied one of the Environments to another and tried to import csv file using ‘Excel’ import feature, file stuck at ‘Submitted’ state.

Reason:

  • Post copy, Environment’s ‘Administration mode’ gets enabled by default, which prevents all background (Async) operations.

Fix:

  • Turn off the ‘Administration mode’

🙂

Power Apps – Component library

Components

In Power Apps, Components are reusable building blocks for canvas apps so that app makers can create custom controls to use inside an app.

  • Components scope is local, which means you can create a Component in an App and can reuse with in the screens of that particular App.
Adding ‘Component’ from ‘Canvas’ App.

Component Library

Component Libraries (Currently in preview) are the recommended way to reuse components across apps.

Unlike the ‘Component’ whose scope is limited with in the App, ‘Component Libraries’ can be reused across the Apps.

In this article, we are going to learn following topics

  • Create a new ‘Component Library’ with ‘Header’ and ‘Footer’ components.
  • Share the ‘Component Library’
  • Use the ‘Component Library’ in Canvas App
  • Modify the ‘Component Library’
  • Update ‘Component Library’ in Canvas App.

Lets get started with Prerequisites.

Prerequisites:

  • PowerApps account. Refer here to get an account.

Once you fulfill the Prerequisites, lets get started with first step.

Create a new ‘Component Library’ with ‘Header’ and ‘Footer’ components:

  • Connect to Power Apps maker portal
  • From the ‘Apps’ tab, click on ‘New component library’.
  • Provide the name and click on ‘Create’.
  • As we know ‘Component Library’ is collection of reusable ‘Components’, In the next screen, a default ‘Component’ would be presented.
  • Rename the default Component to ‘Header’.
  • Add a Label control ‘lblHeaderText’, as shown in the screen.
  • Add a new ‘Custom property’ of type ‘Text’ and name it as ‘Header Text’.
    • A component can receive input values and emit data if you create one or more custom properties.
  • Set the Label controls ‘Text’ property to the ‘Header Text’ property.
    • ‘Header Text’ property will be handy while referring the components in ‘Canvas’ apps.
  • Also set the ‘Header’ components ‘Width’ property to the ‘App.ActiveScreen.Width’.
    • App.ActiveScreen.Width sets the width of Components as per the Canvas app.
  • Lets copy the ‘Header’ component using the ‘Duplicate component’ option, and create ‘Footer’ component.
  • I’ve added a Label and new ‘Custom property’ of type ‘Text’ and name it as ‘Footer Text’, as shown in screen below.
  • Save the ‘Component Library’.
  • In the maker portal ‘Component Library’ would show up.

Share the ‘Component Library’:

Now that we created the ‘Component Library’, we need to share the App.

  • Post the ‘Save’, click on ‘Share’.
  • Add people you would like to share. I’ve shared the Component Library with ‘Everyone’ in my account.

Use the ‘Component Library’ in Canvas App:

As we created the ‘Component Library’ lets put that in use by creating a Canvas app.

  • Create a new Canvas app.
  • To add the ‘Component Library’, click on ‘+ Insert’ and ‘Get more components’.
  • From the list choose the ‘Components’.
    • You would get the ‘Components’ those were shared to you.
  • Added ‘Components’ would be available under ‘Library Components’.
  • Add both ‘Header’ and ‘Footer’ Components to the Canvas app’s screen.
  • Set the ‘HeaderText’ property of the ‘Header’ component. This would immediately changes your Header label text.
  • Similarly, Set the ‘FooterText’ property of the ‘Footer’ component. This would immediately changes your Footer label text.

Modify the ‘Component Library’:

Lets modify the ‘Component Library’ and see how it reflects in the Canvas App.

  • Change the background color of the ‘Header’ component.
  • Save and Publish.
  • Go to ‘Canvas App’ and you would notice banner as below.
  • Click on ‘Review’ and click on ‘Update’ to get the latest Component updates.
  • Canvas apps Header changes as below.

Notes:

  • Sharing a component library works the same way you share a canvas app.
  • When you share a component library, you allow others to reuse the component library.
  • Once shared, others can edit the component library and import components from this shared component library for creating and editing apps.
  • If shared as a co-owner, a user can use, edit, and share a component library but not delete or change the owner.
  • You can’t add existing component libraries to a solution. However, you can create new component libraries for solutions using add component library flow.
  • You can’t access controls in the component from outside of the component.
  • You can’t refer to anything outside of the component from inside the component. The exception is data sources shared between an app and its components

🙂

Power Apps Portal – Remove an Entity from Global Search

If you are not familiar with Portal ‘Global Search’, please refer my other article to learn the steps to configure global search for an entity.

In this article, how to remove global search for a configured entity.

Disable the ‘Search Index’:

  • Open the entity you would want to disable the ‘Global Search’ and navigate to ‘Views’ and open ‘Portal Search’ view.

GS_7

  • Rename the ‘Portal Search’ view and ensure the new name doesn’t have the Portal Search term.
  • Save & Publish.
  • This step will block the entity from getting indexed.
  • Connect to Portal and rebuild the ‘Search Index’ by navigating to ‘../_Services/about’ page and click on ‘Rebuild search index’.

GS_12

Remove the entity from search filters in ‘Site Settings’:

  • Open the ‘Portal Management’ Model-driven App and go to ‘Site Settings’.
  • Open the ‘search/filters’ site setting and remove the entry for the entity you would want to disable Global Search.
  • As an example, for Account the entry would be ”Accounts:account‘. Remove the entry.

GS_4

  • Save the ‘search/filters’ site setting.

🙂

 

 

[Step by Step] Power Apps Portal – Configure Global Search

In this article, lets learn how to configure global search in ‘Power Apps Portals’.

What is Global Search in Portals:

  • Global search of portals allows you to search for records across multiple entities.
  • Allows you to search across multiple columns and configure what columns of an entity would be searchable.
  • By default, few OOB portal entities are enabled for Global Search. To name a few ‘Knowledge Article, Blog, Blog Post, Forum, etc…’.

So lets see how to configure global search for other entities. I am taking ‘Account’ entity for this article and you can pick the entity of your choice.

Prerequisites:

  • PowerApps account. Refer here to get an account.
  • PowerApps Portal. Refer link for steps to enable portal.

Once you fulfill the Prerequisites, you would get the following two Apps in your PowerApps maker portal.

  • ‘Portal Management’ – Model-driven App which contain Portal related entities.
  • ‘Portal’ – Portal app. I named my Portal App as ‘ExpMay2020’.

GS_1

Following are the high level steps to enable global search for ‘Account’ entity.

  • Add/Update Portal ‘Site Settings’.
  • Create a ‘Portal Search’ view in Account entity
  • Add Portal ‘Web Page’ to display the search result.
  • Add ‘Site Marker’ for the ‘Web Page’
  • Grant permissions to Portal Users
  • Rebuild Search Index

Lets get started.

Add/Update Portal ‘Site Settings’:

  • Open the ‘Portal Management’ Model-driven App.
  • Go to ‘Site Settings’ and Add a new ‘Site Setting’ by Name ‘Search/EnableAdditionalEntities’ and  Value ‘true’.
    • Note: Name should be exact match. If you already have ‘Search/EnableAdditionalEntities’ site setting, make sure the Value is set to ‘true’.

GS_2

  • Also make sure the OOB Site Setting ‘Search/Enabled‘ is set to ‘true’.
  • Add a new site setting ‘search/filters’, if not exists already. Open the record, if already exists.

GS_3

  • Set the Value with following pattern {YourDesiredName:EntityLogicalname}.
  • In my case, its ‘Accounts:account‘.
    • Multiple entities must be separated by Comma(,) (i.e., Accounts:account,Contacts:contact)

GS_4

Create a ‘Portal Search’ view in Account entity:

Open the Solution and go to ‘Account’ entity.

  • Create a new View by name ‘Portal Search‘.

GS_5

  • Add the columns which you want to search to the view.

GS_6

  • Save & Publish.
  • Once saved, view shows as below.

GS_7

Add Portal ‘Web Page’ to display the search result:

To open and display the Account record from ‘Global Search’, we need a new ‘Web Page’ with ‘Account’ Entity Form.

  • Create a new ‘Entity Form’ by selecting ‘Account’ entity and map one of the Account form. I’ve named my ‘Entity Form’ as ‘Account’.

GS_21

  • Create a new blank ‘Web Page’.

GS_8

  • Add a ‘Form’ component to the ‘Web Page’ and map the ‘Account’ entity form created in previous step.

GS_22

Add ‘Site Marker’ for the ‘Web Page’:

  • From the ‘Portal Management’ Model-driven App go to ‘Site Markers’.
  • Create a new ‘Site Marker’
    • Name : {EntityName_SearchResultPage}. In my case, its ‘account_SearchResultPage’.
    • Page: Web Page which we created in previous section.

GS_18

Grant permissions to Portal Users:

Portal User must have a minimum ‘Global’ Read access on the entity you are configuring global search for. In my case it’s ‘Account’ entity.

  • Create a new ‘Entity Permission’ as below.

GS_13

  • Create a new ‘Web Role’ and map the ‘Entity Permission’.

GS_14

  • Grant the ‘Web Role’ to the ‘Portal User’.

GS_16

Rebuild Search Index:

We left with one last step before we test the Global Search. Its ‘Rebuild Search Index’

  • Connect to your portal. Navigate to ‘../_Services/about’ page.
  • Click ‘Rebuild search index’.

GS_12

Test the Global Search:

  • Connect to your Portal.
  • Click on ‘Magnifier’ symbol from the ribbon and type your Account to Search.
    • Note: You can Search only the columns available in your ‘Portal Search’ view added on ‘Account’ entity.

GS_23

  • You would get the matching Accounts as below.

GS_19

  • Click on the one of the Accounts link and you would be redirected to that ‘Account’.

GS_20

Note:

  • Refer this PG’s article for more details.
  • To remove the entity from Global Search refer this article.

🙂