Hello everyone,
What I want to achieve is to only show records in a Power Pages list that the logged in user is related to.
I have 2 tables, one is the Contacts which is where logged users are saved and the other is any other table.
Both tables have a column for the relationship, so I know which is related to which.
Have tried to create a many-to-many relationship between the tables. I think it should be many-to-many since many users can have access to many related resources.
Contacts table (logged in users)
# First name Relation Column
1 Test1 11111111
2 Test2 11111111
3 Test3 22222222
Other table
# Some Column Relation Column
1 Test1 11111111
2 Test2 12345678
3 Test3 22222222
Users with ID 1 and 2 will see the record with ID 1 and user with ID 3 will se the record with ID 3.
Have tried to create this relation but I can not say which column the relation should look for.
I also thought that I can do it through the "expression builder", but it lets me say only "Equals" with the data type, for example "11111111", I can not use a variable, in this case being the column of the logged in user.
What would be the best way to achieve this filtering?
I have done this with Liquid, but now I lost the sorting, design and everything the default list have. Any way I can use the below fetchXML query for the default lists?
{% fetchxml myQuery %}
<fetch mapping='logical'>
<entity name='cr1d3_swtest'>
<attribute name='cr1d3_name'/>
<attribute name='cr1d3_cvr'/>
<filter type='and'>
<condition attribute='cr1d3_cvr' operator='eq' value='{{ user.cr1d3_cvrnumberidentifier }}' />
</filter>
</entity>
</fetch>
{% endfetchxml %}