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
ForceLoverForceLover 

Sharing Account/opportunity/leads when user is out of office

Hi Everyone,

I want to share my user accounts,opportunities and lead records when he is out of office with a deligated user .And when he returns back the sharing as to stop.

Please share your views on this and tell me the way how can I achieve this.
AmitAmit (Salesforce Developers) 
Hello,

Write BatchApex class which can check user status and assign or remove sharing rule for user record. 

Please refer following link for sharing a record via apex :

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_bulk_sharing_creating_with_apex.htm