-
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

Salesforce Security Model - An Overview
What is Salesforce Data Security? Presently Salesforce offers a thorough and flexible data security model for tying down data at totally various levels to give…

CPQ Implementation in Salesforce: Challenges and Best Practices
A CPQ software solution can alleviate many, if not all, of the pain points associated with accurate sales quotes. By automatically fetching product details, calculating…

Learn All About the Apex Core Concepts in 2023
Apex code typically contains many things that you might be familiar with from other programming languages. Programming elements in Apex This Image will describe the…
Popular Salesforce Videos
Salesforce Spring ’21 Release Highlights
To improve the platform, Salesforce releases updates three times a year (Spring, Summer, Winter). This is the time for Salesforce Spring ’21 Release. With Salesforce…
Knowledge Base in Salesforce Lightning
By end of this video, we will be able to 1. Understand what is knowledge base. 2. Why we need to use Knowledge base 3.…
DreamTX Welcome Day 1 | Dreamforce 2020 | Salesforce
If you missed DreamTX DAY 1, then live this amazing experience here, we have covered it all for you. Let’s come together for the Dreamforce…
Popular Salesforce Infographics

See How Building Apps on Salesforce Has Tremendous ROI
The pressure that businesses today are under to reduce costs, improve agility, and deliver better results is no joke. Couple that with rapidly evolving technology…

How To Sell Better in 2020 | Tips From Salesforce Leaders
There are various things that you need to pay heed on while selling something. In 2020, where technology is ruling the world, and we are…

Sales Productivity: Tips to Overcome Productivity Challenges
Growing sales is the cornerstone of business success. Whether you're a startup or an established enterprise, the objective remains the same: Increase Revenue, Expand your…