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, 4 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 7 years 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

    Why Everyone Should Integrate SharePoint with Salesforce

    Blog in Salesforce integration

    SharePoint is one of the most popular document management platforms today. It is used by virtually all major enterprises since it ties in neatly with…

    Business Systems, CRM Capabilities, CRM systems, Document Management, Document Management Platforms
    Softweb Sep 30, 2020
    2,363  Views

    What do Customers Gain from Smooth Project Processes? | Salesforce Project Management

    Blog in Salesforce

    Managing a project is not about the developers, it's about the success of a customer. Natalie Deynega, Salesforce project manager at Twistellar, uncovers the secrets of…

    Budgeting, Communication, Contractor, Customer Satisfaction, Customer Teams
    Twistellar Nov 29, 2022
    3,199  Views
    Maximizing Marketing value

    Maximizing Marketing value through Salesforce Datorama Marketing Intelligence and Analytics Tools

    Blog in Salesforce Products

    Salesforce Datorama – With about 7000 marketing technology solutions disrupting the marketing platform, it has been a constant challenge for marketers to get a 360-degree view of…

    Campaign Performance, Datorama Analytics Tools, Marketing Cloud products, Salesforce, Salesforce Datorama
    DemandBlue Mar 22, 2019
    2,611  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

    © 2026 - 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.