Standard rules are those where the field which determines sharing is on the shared object itself.
In all circumstances, full recalculation batch and Targeted Calculation Jobs will always apply the latest sharing to all processed records.
For FormulaShare processing from trigger functionality, sharing changes for these rules which are required as a result of modifications to the shared record itself will be processed in real time. Sharing changes needed following changes in objects referenced in formulas however won't be assessed in real time.
Consider that we have the rule below set up:
Which shares based on the data model below:
We'll assume that FormulaShare is called from a trigger on Donation, and consider scenarios which would lead to a change being needed in Donation sharing.
Changes to the shared or related object
Each time a record in the shared object is created or updated, trigger code will assess sharing impact. We'll illustrate how this works using the examples of specific record setup and changes shown below:
If any of the changes above are made, the real time effects from the trigger functionality for the rules above will happen as follows:
- Creating a new donation: Sharing will apply right away - access to DON-001 will be granted to Finance Manager Malawi
- Updating a donation lookup: Updating the lookup to reference a Programme for a different Country will have the effect of changing the value of the "Finance Manager In Country" formula field on Donation. In this context the corresponding sharing will happen right away when the trigger runs - access to DON-002 will be revoked from Finance Manager Malawi and granted to Finance Manager Zambia. Note that this example illustrates what happens for a formula field, but the principle is the same for other field types - any changes will be identified during trigger assessment.
In a nutshell - changes to the shared or related object for a rule will trigger sharing updates right away.
Note these changes will be made in real time only if the users making record updates have Read access to the field which determines sharing (Finance Manager In Country), otherwise these will be applied when the batch job runs.
Changes to parent record data involved in rules
When changes are made to parent objects which result in changes to formula fields involved in rules, sharing won't be assessed on child objects in real time, even if the parent objects call FormulaShare in their own triggers.
The scenarios shown below illustrate examples of changes which will be treated in this way:
- Change of a lookup relationship in a parent of the object, which changes the formula field value to a different role
- Deletion of a parent record which clears the formula field
- Update of the text field on the parent object referenced by the formula
For each of these changes, donation sharing changes will needed, and will apply next time the batch job runs - either when this is next scheduled or after recalculation of donation sharing is requested from the FormulaShare Rules list.