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.

PowerApps

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

PowerApps

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

PowerApps

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

PowerApps

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

PowerApps

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.

PowerApps

After successful setup it looks like below.

PowerApps

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

PowerApps

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.

PowerApps

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

PowerApps

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

PowerApps

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

PowerApps

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

PowerApps

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

Contact Gallery

PowerApps

Account Gallery

PoweraApps

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

Contact Gallery

PowerApps

Account Gallery

PowerApps

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

PowerApps

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 *