Hi everyone, first post in the Community.I have a default filter on a record type:
a!queryFilter( field: "createdBy", operator: "=", value: loggedInUser(), applyWhen: not( isusermemberofgroup(loggedInUser(), cons!MY_ADMINISTRATOR_GROUP) ) )
The idea is that administrators can view all entries, while regular users can only view entries that they have created.Filter works fine in the record grid view, but breaks the Summary view upon clicking on a record, with the following error:
An error occurred while retrieving the data for “MY_DATATYPE”. Details: Unexpected error executing query (type: [...], query: [Report on Record Type], order by: [[Sort[id asc]]], filters:[((id = TypedValue[it=1,v=1]) AND null)]) (APNX-1-4205-003)
It is evident that the issue is due to the use of the applyWhen parameter (remove it and the problem disappears), but I can't figure out why.So, questions:
1) What is the cause of the problem?2) How can I fix it?3) Is there a better why to achieve what I'm trying to do?
Thanks in advance.
Discussion posts and replies are publicly visible
Hi,
A basic user is not allowed to know whether another user is a member of such groups.
so you need to create a custom logic to check if the loggedIn user is the member of group or not.
Use below logic
contains( a!groupMembers( group : cons!MY_ADMINISTRATOR_GROUP, direct : true() ).data, loggedInUser() )
ThanksVinay
If I try to use your code in the "applyWhen", it breaks. Aside from that, I don't really understand the logic, which seems equivalent. Also, in my tests, I am administrator, and the record grid works fine both as admin and regular user. It's the Summary that breaks, and it always breaks regardless of me being admin.