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
- 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:
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>
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:
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.