FORMULASHARE ENTERPRISE / UNLIMITED ONLY
Enterprise and Unlimited versions of FormulaShare include the option to share using Targeted Calculation Jobs.
These jobs provide the option to assess a subsets of records in a shared object with varying frequencies. This is especially useful in scenarios where:
- A shared object has a large number of records (typically 100s 1000s or more), and you know reassessment of sharing for some records isn't required on a frequent basis
- You'd like to provide near-real-time assessment of sharing for certain subsets of records in scenarios which aren't covered by trigger functionality (see Rule Types and Assessment for more information on circumstances this might apply to)
- You'd like to reduce resources used for batch processing in your org as much as possible
Targeted Calculation Jobs can complement or replace assessments otherwise carried out by the full recalculation batch, which processes every record in each shared object, unless these are configured in Object Settings to be assessed through Targeted Calculation Jobs only.
Targeted Calculation Jobs are set up from the FormulaShare Setup menu:
Managing the Batch
When Targeted Calculation Jobs for the first time, it's first necessary to configure the Targeted Jobs Batch. Click "Manage Batch" to submit this:
This job will check on a schedule for any Targeted Calculation Jobs which are due to be submitted, and submit these if appropriate. This batch is intended to run very frequently (by default once per minute) and has minimal processing overhead if no Targeted Calculation Jobs are due. If you'd like to configure for this to run less frequently, this is possible by adding an App-Wide Settings Override. It's also possible to use an override to change the default batch size (200) used in Targeted Calculation Jobs.
As with the full recalculation batch, it's important that this job is submitted by a user with modify all permission and field access for all objects and fields involved in sharing.
After submitting for the first time, the Manage Batch option allows you to cancel the job, or re-submit this to run under a different user.
Creating Targeted Calculation Jobs
Note that it's only possible to create Targeted Calculation Jobs if one or more objects are configured to have a Sharing Calculation Schedule including Targeted Calculation Jobs in Object Settings.
Click New from the list to configure a job:
- Label, API Name and Description distinguish this job from others
- Object to Process - Jobs are defined for a single object. The objects available in this list will be restricted to those which have a Targeted Calculation Jobs option enabled in the Sharing Calculation Schedule in Object Settings
- Filter Records by Field - The job will process only records matching the criteria defined by a Checkbox (true/false) field on the processed object. Typically it's helpful to use a formula field returning a Checkbox value based on criteria in the record or related parent records. The field referenced in the screenshot for example returns true when a parent or grandparent record's last modified date is within the last 20 minutes:
- Schedule (Run Every) - Controls how often this job should run. Note that if a previous job is still running at the time that the new job is due to be submitted, the new job will be delayed until the previous job finishes
- First Run / Next Run - For new jobs, use this to specify when the job should run for the first time. For existing jobs this will be updated to show when the next scheduled run is due and can be modified when necessary - this can be helpful to postpone jobs until deployments have taken place for example
- Allow Processing in Parallel - This option allows configuring jobs which can run in parallel together with other jobs on the same object. This can improve performance, but this setting needs to be used carefully - if there's a risk that jobs have overlapping criteria this could lead to different jobs attempting to update the same records at the same time, which could lead to locking errors and mean some batches may not be processed. We'd usually recommend this option when multiple Targeted Calculation Jobs are used and there's no chance these could be processing the same set of records