-
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 Customization vs. Configuration: Everything You Should Know
When a business plans to use a Salesforce solution, it is important to make sure that all the business requirements are met. The Salesforce platform…

Your Complete Guide to Salesforce Sales Cloud
Named the #1 CRM solution in the world, Sales Cloud is Salesforce’s most popular product. In this article, we’ll go through everything you need to…
Popular Salesforce Videos
Salesforce Business to Consumer (B2C) Solution Architecture
Salesforce Business to Consumer (B2C) Solution Architecture Introduction, 05 min -Case Study – A Retail Company Journey -A need for Multi-Cloud Solutions -Salesforce B2C Solution…
Developer Life in India | An Interview with Salesforce Chef
Timecode: 00:00 Introduction 01:10 Who is Amit Singh? 01:56 Amit has interesting projects 03:58 Amit does technical content, but he is still popular. How? 05:45…
Custom Button URL Hacking in Salesforce Lightning Experience vs Salesforce Classic
Custom Button URL Hacking in Salesforce Lightning Experience vs Salesforce Classic Custom button URL Hacking approach in Salesforce Classic Custom button URL Hacking approach in…
Popular Salesforce Infographics

What is Salesforce CPQ or Configure, Price, Quote – [Infographic]
Enterprises are using various CPQ tools in order to enhance their business efficiency & revenue by engaging their sales reps in doing actual sales activities…

New Pardot Features: What was delivered in Summer ’18
New Pardot features, summer '18. Pardot has treated us to many enhancements across the core tool and related products. This infographic gives you an overview…

Why Do Business Move To Salesforce?
Salesforce Improves Customer Data Quality & Management – One of the core functions of all CRMs is data management about customers. Salesforce delivers in this…