-
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, 9 months ago by Deepak.
Log In to reply.
Popular Salesforce Blogs
Steps to Install the Salesforce Force.com IDE Plug-In in Eclipse
Force.com IDE can be installed into your existing Eclipse distribution. Following are the prerequisite to install Force.com IDE on your workstation : Don’t forget to check…
Twilio Integration with Salesforce - 2 Important Techniques
Twilio is a cloud communications platform as a PAAS that allows developers to programmatically create / receive / receive / receive / receive / receive…
Salesforce Implementation: An Optimistic View
Explore how businesses can successfully implement Salesforce with effective strategies by overcoming common challenges such as: Data migration: Migrating data from existing systems into Salesforce…
Popular Salesforce Videos
Experience the Most Flexible, Easiest, and Securest Way to Integrate Salesforce and Jira
Integrate standard and custom Salesforce objects with Jira to strengthen cross-functional collaboration and deliver a top-notch customer experience. Fast-Track Your Journey to Attaining Customer Centricity…
How UiPath Robots Upload Files to Salesforce
How #UiPath Robots upload files to #Salesforce and assign to #Case without custom activity just RAW REST API. 0:00 Preview0:55 Intro1:20 Logic in one picture1:38…
Creation Of An Object In Salesforce | Salesforce Custom Objects
In this video, you will learn how to create a custom object in Salesforce, along with verification of the custom object in Salesforce. The following…
Popular Salesforce Infographics
Salesforce Developer Career Path
Embarking along your journey of becoming a Salesforce Technical Extraordinaire is a wise move, as programming in Apex and Visualforce is one of the hottest,…
Salesforce Buy Vs Salesforce Build - An Infographic
Uncover the Process that every business should understand at the time of Salesforce implementation and integration. Salesforce Solution Buying Process Search for Required Solution on…
Enhance Customer Experience With Salesforce
Salesforce Makes Personalized, Consistent Digital Customer Experience a Reality. Salesforce, widely recognized as the leader in business CRM, gives organizations the tools they need to…