Start Plauti Assign Assignee Sync from Apex
The runAssigneeSyncNow method allows you to immediately trigger the Assignee Sync batch job from Apex. This syncs all Match Groups that have Assignee Synchronization enabled, applying Assignee Rules to determine which users should be assignees for each Match Group.
This is useful when you need to refresh assignees on-demand rather than waiting for the scheduled hourly sync job.
Key Points
- Immediately starts the assignee sync batch job (unlike the scheduled job which runs hourly).
- Processes all active Match Groups that have the Assignee Synchronization setting enabled.
- Returns the batch job ID (
Id) which can be used to track job status viaAsyncApexJob.
Apex Example
// Start the assignee sync job immediately
Id jobId = leadassist.PlautiAssignApi.runAssigneeSyncNow();
// Optionally track the job status
AsyncApexJob job = [
SELECT Status, NumberOfErrors, JobItemsProcessed, TotalJobItems
FROM AsyncApexJob
WHERE Id = :jobId
];
System.debug('Job Status: ' + job.Status);Use Cases
- After bulk data updates: Trigger a sync after importing or modifying user data that affects assignee eligibility.
- Integration workflows: Incorporate assignee sync into custom automation processes or job schedulers.
- Testing and troubleshooting: Immediately validate assignee rule configurations without waiting for the scheduled job.
Updated about 10 hours ago