Create Customer Lookup in PowerApps using Data Context

By | July 23, 2018

Introduction:

Recently, we had a business requirement to show customer lookup in PowerApps similar to the customer lookup in Dynamic 365.

For example – In Dynamic 365, we have customer lookup of contact and account, using this we can select contact and account.

To achieve the same thing in PowerApps, we have to use “Context” parameter of navigation methods.

For more details about navigation, methods refer below link.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate

Solution:

Step 1: Select a Blank application as shown in below screenshot.

Create Customer Lookup in PowerApps using Data Context

Step 2: Add two Blank Screen one is Home Screen and Customer Screen which will display account and contact list.

Create Customer Lookup in PowerApps using Data Context

Step 3: Add Dropdown Control, Textbox, search icon on Home Screen as below.

Create Customer Lookup in PowerApps using Data Context

Step 4: Add data source of account and contact in PowerApps as shown in the below screenshot.

To add Source Go to View-> Data Source -> +Add data source

Create Customer Lookup in PowerApps using Data Context

After that Click on Add data Source, the below screen will appear,

Create Customer Lookup in PowerApps using Data Context

If u have different data source then select that one. Here we have selected a Dynamic 365.

Click on Dynamic 365 then select required entity. I have selected Account. After selecting entity click on Connect, data source will get added to PowerApps. Similarly we can add Contacts data source as shown in below screenshot.

Create Customer Lookup in PowerApps using Data Context

After successful setup it looks like below.

Create Customer Lookup in PowerApps using Data Context

Step 5: Add gallery two controls to “CustomerScreen” as shown in below screenshot.

Create Customer Lookup in PowerApps using Data Context

Step 6: Go to HomeScreen select dropdown, to set dropdown value, I have define entityList collection which consist of entityName as property. These will display data on dropdownlist.

Create Customer Lookup in PowerApps using Data Context

Step 7: Now set Items property of dropdown to entityList Collection as shown below.

Create Customer Lookup in PowerApps using Data Context

Step 8: Now add below lines of code in onSelect property of dropdown.

Create Customer Lookup in PowerApps using Data Context

Step 9: Select Search Icon of Textbox then add navigate function as shown below.

Create Customer Lookup in PowerApps using Data Context

Step 10: Go to CustomerScreen and set Items property Contact and Account Gallery to Source collection that define in navigate function.

Create Customer Lookup in PowerApps using Data Context

Step 11: To display only one gallery at a time set visible property of account and contact gallery as shown below

Contact Gallery

Create Customer Lookup in PowerApps using Data Context

Account Gallery

Create Customer Lookup in PowerApps using Data Context

Step 12: To display selected data on HomeScreen Textbox, use Set function on OnSelect property of nextArrow Icon as shown in screenshot.

Contact Gallery

Create Customer Lookup in PowerApps using Data Context

Account Gallery

Create Customer Lookup in PowerApps using Data Context

Step 13: Go to HomeScreen and set default property of textbox as shown in below screenshot.

Create Customer Lookup in PowerApps using Data Context

Note: Instead of Dropdown control, we can use radio Button. Now simply run the application.

Conclusion:

Using the simple steps above user can create customer lookup in PowerApps using data context.

Microsoft Dynamics CRM and QuickBooks Integration

Leave a Reply

Your email address will not be published. Required fields are marked *