-
Help writing my first apex trigger in Salesforce - I have a simple use case in mind
Hello World!
I have a use case that requires a trigger and it sounds about as simple as it gets. We have an external application called BrightTALK integrated with our Salesforce org. Trouble is, we use State and Country Picklists and BrightTALK tries to push Leads into our Salesforce org with Country names that do not match the countries in our Salesforce org. As far as I know, there are two ways to tackle this issue. 1) Change the list of Countries in our Salesforce org. 2) Write a before trigger, which, if I understand correctly, could change a Country value like "China (Hong Kong)" into "China", which our org would then accept because the value matches a value in our State and Country Picklists setup.I have never written a trigger before, and I took one programming class 10 years ago. Does anyone have any recommended places to start, sample code to look at, reference material to refer me to where I can see the methods available to me in an before trigger and learn some syntax? Any help is much appreciated.
Log In to reply.
Popular Salesforce Blogs

Investigating Challenges and Best Practices of Salesforce Test Automation
Undoubtedly, Salesforce is the globally recognized CRM solution with 150,000+ customers. However, to check whether configurations and codes are operational and Salesforce instance is supporting…

Salesforce Leads vs. Contacts: Everything You Need to Know
Understanding the difference between Leads and Contacts is imperative for marketing strategies and effective sales. These two objectives influence tracking prospects, managing relationships, and closing…

Salesforce Lightning Web Components Developer Guide: Chapter 1
We are starting the Lightning Web Components developer guide, a series of articles dedicated to LWC (Lightning Web Components). We will understand the structure and…
Popular Salesforce Videos
Getting started with Salesforce integration patterns using MuleSoft
Learn how to develop different integration patterns between Salesforce and external systems. You can read the full tutorial, and download the project jar file by…
Creating a Roll-up Using DLRS | Salesforce Tutorial Video
In certain situations, an object does not support a roll-up or the relation is not permitted. Learn how to make it possible by using the…
5 Salesforce Hacks to Boost Your Business Sales
Good sales help you to get qualified leads and customers who bring value to you as well. Hence it becomes imperative to have astute resources…
Popular Salesforce Infographics

How to Create a Community of Trust and Gratitude with Salesforce
The businesses that will be remembered positively after COVID-19 are extending empathy and grace to their employees, customers, and communities. We’ve seen so many communities…

Why Salesforce End-user Training Matters for Smooth Implementation
This infographic 'Why Salesforce end-user training matters for smooth implementation' appeared first on Cynoteck. The progress of any CRM implementation depends on its general adoption…

How to Use Psychology to Target Your Buyer?
Ever wanted to get into the minds of your customers and figure out how they think? Ever wanted to know the best methods to convince…