Salesforce Apex Triggers

This documentation guides you through the process of setting up Apex triggers in Salesforce to handle specific conditions related to Opportunities. The exemplary trigger will be designed to execute when an Opportunity meets two criteria:

  1. The opportunity moved to the stage Proposal/Price Quote
  2. It has a value in the custom field cello_ucc

Customize the code as needed based on your individual Salesforce setup. Cello requires at least a "demo done" event as well as a the revenue transactions of won opportunities.

Apex Trigger Configuration

1. Create an Apex Trigger

Find detailed documentation on Apex triggers in the Salesforce docs.

Navigate to Setup in Salesforce and follow these steps,:

  • In the Quick Find box, type "Triggers" and select "Apex Triggers."
  • Click "New Trigger" to create a new trigger.
Apex
Copy

2. Create an Apex Class

Now, create an Apex class to handle the logic and API call. Implement the call to the Cello API in the placeholder method makeApiCall in the below code.

This configuration ensures that the Cello API is triggered when an Opportunity meets the specified criteria. Customize the code as needed based on your individual Salesforce setup, API requirements and endpoint.

Apex
Copy

3. Test and Deploy

  • Test your trigger and class in the sandbox environment to ensure proper functionality.
  • Reach out to the Cello team to confirm that provided event data is correct.
  • Deploy the trigger and class to your production environment once testing is successful.
  • Bulk Processing: Ensure that your Apex trigger can handle bulk updates, as Salesforce triggers operate in bulk.
  • Error Handling: Implement appropriate error handling in your Apex class to manage API call failures.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard