Sync retroactive Salesforce opportunity discounts to Box

CRMMarketingRecipe ToolsDocument/File

What it does

When a scheduled interval triggers, this automation searches Salesforce for opportunity field history using a SOQL query. It checks a lookup table for errors, then creates files in Box for each opportunity with a discount change.

Who it's for

Finance teams who need to track and archive retroactive discount changes from Salesforce to Box on a schedule.

How teams use this

Archive discount changes weekly

Run the search every week on Monday morning so all retroactive discount changes from the prior week are captured and stored in Box. The team has a complete audit trail without manual work.

Alert the sales team on changes

Send a Slack message to the sales channel when a discount change is found and filed. Include the opportunity ID and discount amount so the team knows immediately which opportunities were affected.

Filter by discount threshold

Add a condition to only create files for opportunities where the discount change exceeds a set dollar amount. Smaller changes are logged but not archived, reducing noise in Box.

Run the search daily instead of weekly

Change the scheduled interval from weekly to daily so discount changes are captured and filed more frequently. The automation and lookup table stay the same.

How it works

  1. Search opportunity field history on schedule. On a specified interval, run a SOQL query in Salesforce to find opportunity field history records where discounts changed. The batch returns all matching records.
  2. Check error flag in lookup table. Look up a single entry in the FileData_Append_Status lookup table to see if an error flag is set. If the flag is true, the automation stops.
  3. Filter opportunities by valid ID. For each opportunity in the field history results from Salesforce, check that the opportunity ID is not empty or null. Only records with valid IDs move forward.
  4. Create a file in Box for each opportunity. Create a file in Box for each opportunity with a discount change. The file is tagged with the opportunity ID and discount details from Salesforce.