-
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

What is Salesforce Customer Portal?
Before we start with the Salesforce customer portal, let’s explore all the types of Salesforce portals, their differences, and their use case. Types of Salesforce…

Top7 Benefits of Using Salesforce CDP in 2023
Summer ’21 was the relaunch of Customer 360 Audience, which brought Salesforce CDP to the forefront. In previous articles, we explained what a CDP consists…

How can you Leverage Salesforce Digital 360 for your Business that Everyone is Talking About?
How to effectively develop your business – this is a subject that most business managers and owners grapple with within today’s highly competitive environment. The…
Popular Salesforce Videos
4 Myths About Salesforce
Salesforce is a platform that helps businesses track the journey their customers take. It can help you effectively track and monitor your marketing and sales…
Salesforce AppExchange Pricing Models
Salesforce AppExchange offers a wide range of solutions and applications designed to enhance and extend the functionality of Salesforce. However, understanding the pricing models can…
Accelerate Revenue by Simplifying Partner Data Exchange
Adeptia Webinar :: Self-service approach to set up secured B2B data exchanges. Allowing IT to focus on governance for ensuring compliance, security, and control.Reducing IT…
Popular Salesforce Infographics

Top 5 Salesforce apps for sales and marketing managers
The sales rep, marketing professionals can effectively manage on the customer inquiries from different geographical areas through Salesforce CRM. Here I’m offering a roundup of…

What to expect with a Salesforce project?
It is important to note that one person can fulfill more than one role (typically in smaller projects) but these roles do need to be…

Top 5 ETL Tools for Salesforce Data Migration
There are plenty of ETL tools for Salesforce in the market, with varying degrees of functionality and popularity. All tools are more or less the…