-
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
Pagination of an Infinite List of Records in Salesforce: Challenges and Resolution Methods
Author: Ievgen Kyselov, Salesforce developer at NIX This pagination approach is not new or uncommon, but it's rarely discussed in detail. What I am showcasing…
Salesforce Interview Questions: Crack Any Salesforce Interview
To make sure you gain a detailed understanding of the types of questions you can expect during your job interview. We'll start by covering the…
Back Up Metadata to Secure and Restore Your Customizations | Salesforce Guide
You can protect your organization’s customizations, like customized fields, custom Apex code (Everything you wrote in your console), page layouts, reports, and permission sets, by…
Popular Salesforce Videos
Translation Workbench | Salesforce Tutorial
One of the most common questions new Salesforce admins ask us is how can they translate custom terms when their org is in multiple languges?…
7 Tips To Choose The Right CRM For Your Business
A Customer Relationship Management (CRM) system can be overwhelming to choose from. You have so many options to choose from, each offering different tools and…
How to Become a Salesforce Developer? No Programming Experience Needed
Salesforce Developer has once again been named one of the world's best jobs. In a list of 25 job roles, Salesforce was the only company…
Popular Salesforce Infographics
Benefits of Integrating Tableau with Salesforce
Tableau Integration with Salesforce helps businesses gain a multitude of advantages. The true power of Salesforce CRM is felt only when business users can analyze…
Salesforce Marketing Automation: Sales or Marketing Tool? [infographic]
Marketing automation has a hidden talent. Despite being marketed for years as a tool for, well, marketers, automation is changing the shape of the modern…
What Can Salesforce’ Non Profit Success Pack Provide You With?
The Nonprofit Success Pack NPSP (formerly known as "Nonprofit Starter Pack) is a set of managed packages developed and maintained by Salesforce.org and made available…