-
Is there any need of map when we can insert & update using List only in contact mailing address?
trigger update_MailingAddress on Contact(before insert,before update) { set<id> accountIdset=new set<id>(); for(Contact con:trigger.new){ if(con.AccountId!=null){ accountIdset.add(con.AccountId); } } list<account> accList = [select id,billingCity,billingState,billingStreet,billingCountry from Account where id iN : accountIdset]; for(Account acc : accList){ for(contact con :trigger.new) { con.MailingCity = acc.billingCity; con.MailingState = acc.billingState; con.MailingStreet = acc.billingStreet; con.MailingCountry = acc.billingCountry; } } }
- This discussion was modified 4 years, 8 months ago by Deepak.
Log In to reply.
Popular Salesforce Blogs
Top Salesforce Spring '23 Flow Features | Salesforce Guide
A flow in Salesforce is a tool for automating intricate business procedures. In other words, it gathers data and uses the data for processes. The…
What is Salesforce CPQ and How Does it Work?
Salesforce CPQ is a software solution that helps businesses automate and streamline their sales processes by providing a way to quickly and accurately create quotes,…
Top 5 Salesforce Integrated Marketing Automation Tools
Marketing which is a major function for every business is constantly shifting and evolving and hence becoming increasingly complex as consumers are relying on a…
Popular Salesforce Videos
Salesforce Sales Cloud Training | Sales Cloud In Salesforce | Salesforce Tutorial
This Salesforce Sales Cloud Tutorial will help you understand what is leads home page, how to create contacts, how to create products and all creating…
How To Use Data Loader In Salesforce - Learn Salesforce Series By Algoworks
Learn how to use Data Loader in Salesforce. In this video, the following points will be covered - 1. Introduction Here you will get a…
Object Oriented Programming - Salesforce Developer Tutorial
In relation to programming languages, object-oriented means that the code focuses on describing objects. An object can be anything that has unique characteristics, such as…
Popular Salesforce Infographics
Top Salesforce Trends For 2023
When it comes to managing customer databases, Salesforce is leading the pack. Companies are increasingly relying on this powerful tool for its unrivalled flexibility and…
A Day in the Life Infographic: Best Practices Guide for Sales Users
The internet is full of sales best practices. But what most people forget is that, as a business, you need to come to the understanding…
Here’s What Makes Up Salesforce’s Customer Base
Recently Mintigo took a close look at Salesforce’s customer data. Their analysis sheds some light on what their customers are up to and how the customers have…