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
Stefano Portelli +Stefano Portelli + 

Sharing standard records with end date

Hi all,
is there a declarative way to share a standard object's record with an end date? I would like to share an Opportunity or a Contact with someone else (with the same profile that I have) and this sharing rule shall be revoked automagically once end date is reached.
Will process builder be able to fulfill this requirement or shall I use Apex code?

Thanks in advance,
Stefano
Sagar PatilSagar Patil
Hi Stefano,

You can use Manual sharing button to share the records with another user if OWD for opportunity/contact is Private or Read only.

Since you need to invoke this rule automatically when the end date is reached, hence above approach won't work. Try below steps.

Setup -> Sharing setting -> Opportunity/Contact sharing rule --> New -> Based on Criteria -> Mention the criteria related to End date

Till now it is fine but as you've mentioned you need to share the record with someone ( I have consider here with only one user) for which you will have to create the Public Group and include only that user in it.

Now back to our chain,

After speciying the criteria --> Select Share with Public Group -> Name of group -> Provide the appropriate access (Read only/Read-Write)

This should do the trick.

Kindly mark this answer as best answer if it helps you.

Regards,
Sagar

 
Stefano Portelli +Stefano Portelli +
Hi Sagar,

first of all thanks for your response, but if I understand correctly, if I define a sharing rule on Opportunity that rule is binded to a specific Public Group, I will be forced to use always the same Public Group, even if I will be able to change the "content" of the public group...
What if I would like to allow to any sales rep to share the Opportunity with another sales rep specifying the Target Sales Rep Name and Sharing Due Date?