In this post we want to share a couple of brief use case studies which highlight some of the work we do with APEX triggers in Salesforce.
Design and create Apex trigger for new functionality
Problem: When a contact responds to a campaign, Salesforce has no way to automatically assign a task based on an area code territory so that it is automatically assigned to the appropriate sales person.
Solution: In just a few hours StarrForce designed a Custom Settings table in Salesforce to hold all area code assignments and then created, tested, and deployed a Saleforce APEX trigger to assign a task to the sales person based on the area code of the contact that responded to a campaign. This freed up the Salesforce Administrator at our client to focus on other projects and requests.
Modify an existing Apex Trigger to meet new requirements
Problem: An existing trigger that our client created would take the Contact from a custom lookup field on an Opportunity and add it as the Primary contact in the Contact Roles related list.
Salesforce has functionality that will create a Contact Role in the related list when an Opportunity is created from the Opportunities related list of a Contact record. It will also do this when converting a Lead and creating an Opportunity. But the Salesforce functionality does not mark the contact as Primary. So when the Salesforce functionality activated, the existing trigger would fire as well. This resulted in the contact being entered into the Contact Roles related list twice: once as a Primary Contact and once without the Primary flag.
Solution: StarrForce redesigned, created, tested, and deployed an APEX trigger to first look to see if the Contact was in the Contact Roles related list and if it was, the trigger would mark the Contact as Primary. If the Contact was not there, it would be added from the custom field as Primary.