Power Apps Portals – Entity List: Conditional Action

Power Apps Portals allows us to fire actions against the individual records presented in an Entity List, these actions can be:

  • Trigger an On-Demand Workflow
  • Redirect to a Web Page
  • Activate/Deactivate the record
  • Create a related record
  • Delete / Edit the record
  • View Details of the record

This feature comes very useful when we have multiple forms in the same entity, or we want to redirect to another page passing parameters, etc.

The purpose of this post is not to go deep on creating the Entity List and associate the Actions, for more information on this, check the following documentation: https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/entity-lists

In this post, I will show how to filter (display/hide) the Entity List Action options based on the record data with a Fetch XML filter:

  • Create an Entity List record – I am creating a simple entity list pointing to the Active Contacts view
entity list - conditional action 01
  • Create an Action to your Entity List
    • I am creating a simple Workflow (On-Demand) to send an e-mail to the contact
  • Create a Web Page record to show the record Details
    • This will be a Details action

At this moment, if you test your Portal, you will see the two options available in the Action menu for each Item:

entity list - conditional action 05
entity list - conditional action 02

Now I want to make a validation against the record to filter my actions, in my case, as an example I will make the following validation:

  • If the Contact’s email field is empty
    • Hide the “Send e-mail” option

In the Entity List record, go to the Actions under Grid Configurations, select Advanced Settings and add a Fetch XML in the Filter Criteria (the Fetch XML must contain the header/basic structure, not just the filter):

<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
    <entity name=”contact”>
        <filter type=”and”>
             <condition attribute=”emailaddress1″ operator=”not-null” />
        </filter>
     </entity>
</fetch>

entity list - conditional action 03

Now when I go to my Portal and select the actions dropdown for a contact with no e-mail address, the “Send E-mail” option won’t be availeble:

entity list - conditional action 04

This filter is very helpful to achieve common requirements using Entity Lists.

I hope this was useful to you, and hope it helps with your Power Apps Portals project.

One thought on “Power Apps Portals – Entity List: Conditional Action

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s