Activity Forums Salesforce® Discussions What is the meaning of newMap and oldMap in Salesforce trigger?

  • Anuj

    Member
    January 27, 2020 at 1:05 pm

    Hi Aditya,

    NewMap in Apex Trigger is a Map of Id's which return New Version of records and It is available in

    before update, after insert, after update, and after undelete triggers only.

    OldMap in Apex Trigger is a Map of Id's which return older version of records and It is available in Update and Delete triggers only.

  • Manish

    Member
    January 27, 2020 at 1:42 pm

    Hi Aditya

     

    Trigger.NewMap: Trigger.newMap returns map of new records which are trying to insert into Database. This is available in Before Insert, Before Update, After Insert,  After Update Triggers and undelete Triggers. This list of records can only modified in Before triggers.

     

    Trigger.OldMap: Trigger.oldMap returns map of old records which are updated with new values. These List of records already there in Database. Trigger.oldmap available in Before update, after update, Before Delete and After Delete triggers.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos