Objective is to share a 'User Group' with itself. Following code works fine to share a 'User' with a 'User Group', but not for sharing 'User Group'.
UserShare groupShr = new UserShare(); groupShr.UserId = toShareId;//works for ID of User, not for ID of User Group groupShr.UserOrGroupId = spaceGroupId; groupShr.UserAccessLevel = 'Read'; groupShrList.add(groupShr); insert groupShrList;
Exception thrown if above code tries to share user group is FIELD_INTEGRITY_EXCEPTION, User ID: id value of incorrect type: 00GF0000004ucwlMAA: [UserId]: Trigger.TriggerName: line 30, column 1
Is it possible to share user group?