I have created a custom object for managing user group membership, so that the Case object now has a Owner Group field. I want to display all cases owned by the group(s) that the current user is a member of. How can I create a model that support this?
Peter, sounds like a subquery condition should do the trick for you.
So you will need to create a Model of the Case object.
—
Add a new condition to the Model. Set the field to OwnerGroup__c (or whatever you named it).
For the value, choose “Result of subquery” from the Content dropdown. The condition will limit the records in your Case object to only those cases with an owner group Id in the subquery.
The join object would be your junction object (maybe named “UsersGroups__c”). The Join field will be the GroupId__c (whatever field matches up with your OwnerGroup__c).
The operator for the condition will automatically switch to “in” since this is a subquery condition.
—
Now, add a subcondition (by clicking that little “lego” block). This will filter the subquery.
The field for the subcondition will be UserId (or whatever you named it).
For the value, choose “UserInfo of page viewer” and select UserId.
—
The result is that your subquery will contain all of the groups where the current user is a member. Then only the cases with an owner group within the subquery will be retrieved from the database.
I hope that helps.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.