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 

Need to share user records when he 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 regarding this.
Anil SavaliyaAnil Savaliya
Hi,

Write BatchApex class and It's suppose to be run twice in day,And check User in office or out of office,and accourdig to user condition assign or romove sharing rule for user record.

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


AmitAmit (Salesforce Developers) 
Hello,

Write Batch Apex 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