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
girbotgirbot 

Criteria Based Sharing: Using Current User ID

Hi Y'all, Is it possible to have a criteria based sharing rule which references the current user id? For example we have an custom object, called events, and we would like the presenters to only see the events they are running. I have had a look at the criteria based sharing, but have not been able to reference the current user id to achieve this. Any ideas? Thanks in advance :)
shra1_devshra1_dev

why to have a criteria based sharing rule for this. If you give the org wide defaults to private then the users can access only their records.

 

If problem is not solved can you explain the thing more clear?

 

Regards,

Shravan

girbotgirbot
The presenters will have read-only access, and will not be creating or owning any records. They would need access for information about the event and the attendees. They will not be making any edits to the record.
shra1_devshra1_dev

Criteria cannot be dynamic, It should be static.

 

So you cannot give the criteria with logged in User Id.

 

 

Regards,

Shravan

girbotgirbot
That is the conclusion that I had come to. I just wondered if anyone before me had found a work around or could offer an alternative way of achieving it.
MohandaasMohandaas

Girbot,

 

Apex managed sharing would help you achieve this. You can dynamically create shares for the presenter to his/her events.

 

events__share s = new events__share();

s.UserOrGroupId = events__c.presenter;

s.RowCause = 'manual';

s.ParentId = events__c.Id;

s.AccessLevel = 'Read';

insert s;

 

Hope this helps...