-
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 Automation with Flow
Following on from the previous article on Salesforce automation tools, this time we cover automation using the brand-new Flow Builder tool (as released in Feb 2019). This…
Low-Code Salesforce REST API Integration - All You Need to Know
Salesforce offers a REST API that allows you to integrate with third-party applications. This guide illustrates how to integrate with Linx, a low-code application development…
Shaping Customer Experience in Banking with Salesforce
Just like any other industry, banking these days faces an urgent need to reimagine itself and work on achieving new opportunities for growth. The need…
Popular Salesforce Videos
What are the Objects in Salesforce?
What is the difference between Profile Vs Permission Set? Salesforce Interview Questions and Answers by CRS Info Solutions. Watch this video to learn more. Read…
Get Started With Empowering Your Sales Users in Salesforce Pardot
This Get Started With Empowering Your Sales Users in Pardot series will help your sales reps sell more and save time with Pardot features. The…
How to Track UTMs from Pardot Through to Salesforce Campaigns
UTM parameters can be used to track the traffic from a variety of sources including email, social media, banner ads, and more. But how can…
Popular Salesforce Infographics
Salesforce Dreamforce: A History of Innovation
Salesforce is anything but your average technology company. From its 1-1-1 philanthropic model to the scrappy startup culture, Salesforce defies traditional logic for how a…
Salesforce Marketing Cloud Features, Benfits and Advantages
Elevate Your Strategy: Discover the 4 Power Moves with Salesforce Marketing Cloud 1. 𝐏𝐫𝐞𝐜𝐢𝐬𝐢𝐨𝐧 𝐓𝐚𝐫𝐠𝐞𝐭𝐢𝐧𝐠 Laser-focused campaigns for maximum impact. 2. 𝐃𝐚𝐭𝐚-𝐃𝐫𝐢𝐯𝐞𝐧 𝐈𝐧𝐬𝐢𝐠𝐡𝐭𝐬 Real-time analytics…
Salesforce Events of 2018 | Infographic
Complete Salesforce Event Timeline for 2018 including Dreamforce, Salesforce World Tour and the Dreamin' events from all over the world. Use those links to connect…