function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SUHSUH 

GroupMember: What is this object exactly?

Really confused newbie here.

I have read the following info provided by salesforce but its making me more confusing.

https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_groupmember.htm?search_text=Public%20Group

Because the share button doesnt work in Lightning, I have built following system.

Custom Object: Notification__c and NotificationShare__c
Flow: sharetoQueue

In the flow

1. User opens a flow screen in the Notification__c record and chooses a queue to share it with

2. Once queu is chosen and clicked "next", the Id of the queue user selected is retrieved

3. the record of GroupMember where the GroupId matches the Id retrieved in #3 is searched

4. Once match is found, the flow retrieves the UserOrGroupId of the match

5. Using the Object_Share, A child record of the Notification__c's record is created in  NotificationShare__c and UserOrGroupId is set to the data retrieved in #4

6. Other users in the chosen queue can now view the Notification__c record




Can anyone explain what GroupMember object and UserOrGroupId  is exactly with examples?
Diagrams or drawn images would be really appreciated.

Thanks in advance.
ManojjenaManojjena
Hi  SUH,

When ever you are adding any member to the prublic Group will be created one record in GroupMember which has  
1. UserOrGroupId : This is the member reference either a user id or another group Id 
2.GroupId  : Id of the group under which you are adding member (member can be a group /User)

Hope you are clear now ,you can go to work bench and get more details .

Thanks ,
Manoj

 
Andrew GAndrew G
Hi SUH

GroupMember object is a joining object between User/Group and Group.

If we think it through, a User can be a member of many groups.  And a Group can have many Users.  To allow for this we have the joining object which allows this many to many relationship.  

The UserOrGroupId allows for the fact that a Group can also have other Groups as subsets.  So therefore the UserOrGroupId points to the Group or User that is a member of the Group (identified by the GroupId field).  In this case, the UserOrGroupId is a Lookup field that points to either a Group or User

Hope that is helpful

Regards
Andrew