Tuesday, 21 July 2020

PowerApps Portals - Lookup Editor Control

Introduction

Hi Folks,

Welcome to my Power Guide Mentorship Program. Hope you all are doing great and staying safe.

Today, I am going to share #PowerGuideTip15, where I'll show you how you can directly update the lookup record on the portal, without navigating away from the Portal page.

There are many business requirements, where a portal user wants to view/update the lookup record.

Though I have already written an article on the same, however in that approach, I am giving a solution to open the portal lookup record in the new tab, where you can edit/update the lookup value.

Can check here.

The drawback of that approach was the user had to navigate away from the main portal page in order to update the lookup record. And it becomes more complex when a user has to update multiple lookup values.
.
To overcome these issues, Today, I am going to share an advanced approach using that, portal users can View/Update the lookup records without navigating away from the main page.

Let's get started...

Requirement

View and Update Lookup record on Portal Entity Forms

Implementation

Step 1 - Download the web template code from my Git Hub Repository



Step 2 - Create Web Templates



1. Portal Lookup Editor - Purpose of this web template is to convert the normal lookup available on the Portal Entity Form into an editable lookup



2. Portal Lookup Template - The purpose of this web template is to open the lookup record in the webpage associated with an entity form (Edit Mode).



Since this web template has to be used on all the webpages (Step 4) that are required to View/Edit the lookup record information. Therefore, we need to create a Page Template as well



Step 3 - Create Site Settings



1. Lookup Editor - Name - The purpose of the site setting is to provide the lookup attributes schema names (in comma separated format) that you want to show in an editable format.

For Example - Let say, I have three lookups: Customer (customerid), Contact (primarycontactid), and Partners(new_customer) on my Case Entity Form. I want to convert these lookups into an editable lookups. Hence, my site setting value would be like:

customerid,primarycontactid,new_customer



2. Lookup Editor - Page - The purpose of the site setting is to provide the webpage partial URL names (in comma separated format) where you want to display/edit the lookup record information.

For Example - Let say, I have three lookups: Customer (customerid), Contact (primarycontactid), and Partners(new_customer) on my Case Entity Form. I want to convert these lookups into an editable lookup. In order to view/edit the lookup records, I have created two webpages and associated them with an entity forms of the respective lookup entities.
  • Webpage - Edit Account (Partial URL - 'edit-account') associated with Account Entity Form, will be used to View/Edit the Customer and Partner Lookup record and
  • Webpage - Edit Contact (Partial URL - 'edit-contact') associated with Contact Entity Form will be used to View/Edit the Contact Lookup record.
Hence, my site setting value would be like:

edit-account,edit-contact,edit-account


3. Lookup Editor - Role - The purpose of the site setting is to provide the web role names (in comma separated format) to whom you want to enable/disable the lookup editable control feature.

I want, that anyone who is authenticated on the portal or either having Team Lead or Team Manager web role could see the lookup editor control. Hence, my site setting value would be like:

Authenticated,Team Manager,Team Lead




4. Lookup Editor - Icon - The purpose of this site setting is to configure the Lookup Editor Icon based on your business need. By default, this site setting value is 'glyphicon glyphicon-pencil', which displays the 'pencil' icon on the portal lookup fields and indicate that lookup record can be Viewed and Edit both.
However, if you have a requirement to allow portal users only to View the lookup record, then you can change the site setting value to 'glyphicon glyphicon-eye-open

To View/Edit Lookup Record - glyphicon glyphicon-pencil

To View Lookup Record - glyphicon glyphicon-eye-open

Default Value - glyphicon glyphicon-pencil





Important Note-  Make sure, there is no white space in all the Site Setting values.


Step 4 - Create Web Pages and Entity Forms

Webpages and Entity Forms need to be created based on your business requirement.

  • One webpage would be required to show an entity form on the portal, where you want to edit your lookup values. In my demonstration, I have created a webpage and associate it with the Case entity form. And case entity form has 3 lookups - Customer, Contact, and Partner.
  • This webpage must include the Web Template (Portal Lookup Editor) created in Step 1. 




  • Rest other Webpages and Entity forms would need to be created based on the number of editable lookup fields you want to have on the portal. For Example, In my demonstration, I have three lookups. One lookup refers to the Contact entity and rests 2 other lookups refer to the Account entity. Hence, I require 2 more webpages along with 2 entity forms (account and contact).







Step 5 - Demo 





Portal Lookup Editor - Security

1. Portal Lookup Editor Control provides Web Role-based Security. That means you can enable and disable this feature based on the portal web role.

For Example - If you want this control to be enabled only for those portal users who are having Webrole1 or Webrole2, then you can manage it using Lookup Editor - Role Site Setting (mentioned in Step 3). However, if you want to provide a more granular level of security, then configure the Entity Permission and enable the Entity Permission Checkbox on your Entity form. So that unauthorized Portal users would not be able to Edit the Lookup record

2 If you have a requirement to allow portal users only to View the Lookup record, then you need to create your Entity Forms (created in Step 4) in Readonly mode instead of 'Edit mode'. Also, change Lookup Editor - Icon Site Setting value to 'glyphicon glyphicon-eye-open'.


1 comment:

  1. Dear Arpit,
    Thanks for useful tip.
    We have tested it on our side but unfortunately, using the Portal Lookup page template only renders a blank page.
    Is there a way to fix this? Of course, ready to share any useful details.
    Thanks !
    Bob

    ReplyDelete

Blogger Widgets