cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hmedhat
Helper II
Helper II

I want to filter the entity record view according to the login portal user email vs Email1 field .Email1 is a text field not a lookup and already contain values .

 I want to filter the entity record view according to the login portal user email vs Email1 field .Email1 is a text field not a lookup and already contain values .

11 REPLIES 11
EricRegnier
Super User
Super User

Hi @hmedhat,

We'll need a little more info. The view you would to filter is to display on Power Apps portals? I don't know your requirements, but may I ask why you would like to filter on email? For security and privacy reasons, it would not be safe to filter just on the email field. For example, I can change my email in my profile to your email and then suddenly gain access to your data...

You can filter on portal user which is as designed by configuring entity list record for your view with the "Portal User Attribute".

Hope this helps...

Thanks

 

First you can't register duplicate emails second you are right i want to filter based on the login user email vs a text field in my entity .

Example :

name          email              age    role

hanihani.ds@r.com32a
ericeric.asd@df.com31a
alexalex.asd@sad.com28b
hanihani.ds@r.com32c
ericeric.asd@df.com31d

 

I want to filter the view for the above entity with column email with the login portal user .knowing that the email is a text field.

v-siky-msft
Community Support
Community Support

Hi @hmedhat ,

 

Your need can be achieved through custom Web Template using a combination of the Liquid markup language and JavaScript. 

The Web Template can then be used as the foundation to display your filtered list in very customized ways.

 

As to your case, I would recommend @OliverRodrigues 's answer referenced from here ,  modify to get user.internalemailaddress and filter the entity list on that.

 

Hope this helps.

Sik

 

@v-siky-msft @OliverRodrigues 

I tried this but i don't get any records.

///{% extends 'Layout 1 Column' %}

{% block main %}
{% include 'Page Copy' %}
{% include 'Child Navigation' showdescriptions: true %}
{% include 'entity_list' key: '33' %}
 


<script>
$(document).ready(function () {

var userName = "{{ user.emailaddress1 }}";
var entityList = $(".entitylist.entity-grid").eq(0);
console.log(userName);
entityList.on("loaded", function () {
// Get rows
entityList.find("table tbody > tr").each(function (index, value) {
var tr = $(this);

var contactNameAttribute = tr.find('td[data-attribute="emailaddress1"]');

if (contactNameAttribute.length > 0) {
console.log(contactNameAttribute);
var contactNameValue = $(contactNameAttribute).attr("data-value");

if (!!contactNameValue) {
console.log(contactNameValue);

if(contactNameValue != userName)
{
tr.hide();
}
}
}
});
});
});
</script>

{% endblock %}\\\

Hi, I am a bit out of the loop here but let's see if I can help

 

  • is your Entity List bringing records? is that name correct? "33"? 
  • if the above is fine, I am wondering if it is because your Entity List hasn't yet rendered on the page
    • to test this, put your code in a separate function, for example:

 

$(document).ready(function () {
    MyEntityListCustomFilter();
});

MyEntityListCustomFilter function(){
    // your code here
};

 

  • that won't change anything, but now you can easily go to the page, open the browser console and trigger the function MyEntityListCustomFilter, and this way you can test your function to see if it is doing what you want
  • okay, now you tested and have your logic working, I would now suggest attaching to the loaded event of the entity list, for example:

 

var list = $(".entity-grid");
list.on("loaded", MyEntityListCustomFilter);

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

@OliverRodriguesI 'm really done everything 2 weeks struggling with this and I have aproject with deadline coming in powerapps it was very easy python is easy also but this liquid inside javascript inside xml and I put alot of effort in this many try and error and I 'm really disappointent  ,it's only a text field in my entity to filter with the login user email to see his records and i don't get why it has to be lookup field ,I want to capture the user login to portal email and filter my entity according to this.

 

Please Oliver if there anything else you can help me with tell me.

Let's say I have entity list contains 2 text fields email and productname.

I want when I user login to the portal he can see only his products in the entity list.

What shall I do?

 

Hi

are products associated to the Contact record via a lookup? or only via e-mail (text field)?




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

only via email text field .

there are many records because i imported this records from sql to cds,so it is impossiable for me to create a relationship with contact entity and start to fill all these lookup records in my entity,thanks for understanding and helping @OliverRodrigues 

@OliverRodriguesI really need help here

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,919)