Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › Difference between Trigger.New and Trigger.NewMap in Salesforce?

    Tagged: Account ID, Difference, Maps in Salesforce, Salesforce Development, Salesforce sObject, Salesforce Trigger, Trigger New, Trigger NewMap, Trigger OldMap

    • Salesforce® Discussions

      Difference between Trigger.New and Trigger.NewMap in Salesforce?

      Posted by sushant on December 8, 2016 at 2:47 PM

      Hi All,

      What is the difference between Trigger.New and Trigger.NewMap in Salesforce?

      please give suggestions!

      Thanks

      Parul replied 7 years, 2 months ago 4 Members · 4 Replies
      • Account ID
      • Difference
      • Maps in Salesforce
      • Salesforce Development
      • Salesforce sObject
      • Salesforce Trigger
      • Trigger New
      • Trigger NewMap
      • Trigger OldMap
    • 4 Replies
    • Vikas Kumar

      Member
      December 8, 2016 at 5:22 PM

      Hi Sushant

      Trigger.new return the ordered list whereas trigger.newmap returns a map which is unordered

      In other ways

      Trigger.new
      Returns a list of the new versions of the sObject records. Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.

      Trigger.NewMap
      A map of IDs to the new versions of the sObject records, this map is only available in before update, after insert, and after update triggers.

      hope it may help

      • This reply was modified 6 years, 11 months ago by  Forcetalks.
    • sushant

      Member
      December 13, 2016 at 1:59 PM

      Thanks Vikas

    • shariq

      Member
      September 21, 2018 at 12:25 AM

      Hi,

      Trigger.OldMap: A map of IDs to the old versions of the sObject records. Note that this map is only available in update and delete triggers.

      Trigger.newMap: Trigger.newMap is a map with key as ID of the record and value as the record itself. Just like the above explanation, in case of accounts when we say trigger.newMap we are talking about a map of key-value pairs where the key is the account ID and the value is the account record itself.

      A map of IDs to the new versions of the sObject records.Note that this map is only available in before update, after insert, and after update triggers.
      oldMap
      A map of IDs to the old versions of the sObject records.Note that this map is only available in update and delete triggers.

      Hope this helps.

    • Parul

      Member
      September 21, 2018 at 4:38 AM

      Hi Shariq,  Difference in Trigger.New and Trigger.NewMap:

      trigger.new is simply a list of the records being processed by the trigger, so if all you need to do is loop through them then you can use that.

      trigger.newMap just allows you to target specific records by Id should you not need to process everything, or if you need to map other records back to these.

      set<Id> accIds = new set<Id>();
      for(Account acc : Trigger.new)
      {
      accIds.add(acc.id);
      }
      //query the contact records now from currently processed Account Ids
      List<Contact> lstContact = [select id from contact where Accountid in : accIds];

       

      Get All the Account ids from Trigger.Newmap

      List<Contact> lstContact = [select id from contact where
      Accountid in : Trigger.newmap.Keyset()];

       

      Thanks

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    Salesforce Jira Integration

    Powering Real-Time Two-Way Synchronization Between Salesforce and Jira

    Blog in Salesforce

    In today’s business environment, efficient data management is crucial for any successful company, and CRM systems have become essential tools among businesses of all sizes.…

    Business, Business Environment, Business Processes, Collaboration Tool, Communication
    Grazitti Mar 29, 2022
    1,615  Views

    Meet Astro, Codey & Friends | The Salesforce Trailhead Family

    Blog in Salesforce

    Salesforce changed the way people perceived business software when it launched in 1999. Marc Benioff, CEO of Salesforce, imagined making software easier to buy, use…

    AppExchange Environment, Appy, Artificial Intelligence, Astro, builder
    Apphienz Apr 19, 2021
    3,628  Views
    Flows in Salesforce

    Learn About Flows in Salesforce

    Blog in Salesforce Stories

    Salesforce flow, together with process builders and workflows, is a very powerful automation tool. A flow conducts any of the actions specified at the moment…

    Apex Schedule Jobs, Auto Launched Flows, Automated Operations, Automation Tool, Business Procedures
    Sandeep Singh Dec 22, 2021
    4,345  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2025 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.