How do I ensure Chargebee jobs run under the correct user in Salesforce?
Problem Statement
Salesforce records created or updated by Chargebee sync jobs appear under an unintended Salesforce user. Manual Sync and Auto Sync use different Salesforce user contexts.
Related Scenarios
- Salesforce records are being created under a named user instead of the integration/system user.
- Chargebee jobs are manually re-run and affect user context in Salesforce.
- Auto Sync jobs are running under a previous Salesforce user.
- Manual Sync records appear under the user who initiated the sync instead of the integration user.
Solution
When Chargebee jobs are manually re-run using a named user, Salesforce records triggered by these jobs may be created under that named user instead of the intended integration/system user.
It is important to distinguish between Manual Sync and Auto Sync, as they use different user contexts:
- Manual Sync: Records created or updated when a user clicks Sync Records appear under that Salesforce user's name. This is expected behavior.
- Auto Sync: Scheduled Auto Sync jobs run under the user context in which the Auto Sync job was registered. To ensure automated jobs run under the integration/system user, Auto Sync must be disabled and re-enabled while logged in as that user.
Before you begin, log in to Salesforce as the integration/system user that should own future scheduled sync jobs.
-
In Salesforce, go to Chargebee Settings > Sync Health > Sync Settings.
-
Turn Enable auto sync off.
-
While still logged in as the intended integration/system user, turn Enable auto sync on again. This re-registers the scheduled Auto Sync job under that Salesforce user's context.
-
In Salesforce, go to Setup > Jobs > Scheduled Jobs and confirm that the Chargebee scheduled sync job is owned by the intended integration/system user.
-
After the next scheduled Auto Sync, inspect a created or updated Salesforce record and confirm that it reflects the intended user. Review Sync Health and the sync logs to confirm that the job completed successfully.
Important Notes
- Manual Sync will always be attributed to the user who manually runs the sync. This is different from Auto Sync and is expected behavior.
- Disabling and re-enabling Auto Sync under the integration/system user changes the user context for future automated sync jobs; it does not change the attribution of previous manual syncs.
- Always perform Auto Sync configuration changes while logged in as the intended integration/system user.
- Ensure the integration user has all required Salesforce and Chargebee permissions.
- If the integration user is deactivated or replaced, Auto Sync should be reconfigured under the new integration user.
- Regularly monitor Sync Health and Salesforce record creation to identify any unexpected user-context changes.
- If the issue continues after Auto Sync has been re-registered, review the Salesforce scheduled/Apex jobs and the Chargebee integration configuration.
Related Articles
Was this article helpful?