Salesforce Free Developer >

Chapter 8 - Exception Handling >

Trigger.new | Context Variable in APEX

Trigger.new | Context Variable in APEX

Trigger Context Variable:

Context Variables allow developers to access run-time context of any trigger.

These context variables are contained in System.Trigger class.

Types of context variable:

Trigger.new: 

trigger ApexTrigger on Account(before insert) 

{    

    for(Account acc: Trigger.new)

    { 

         acc.NumberOfEmployees = 100;

    }

}

Note: This sObject list is only available in insert, update & undelete triggers and records can only be modified in before triggers.

Download Study Material

Get access to exclusive study material for Salesforce Certification and ace your exams!

Our Salesforce Certification Courses

Hey there! Glad you made it through our Salesforce Developer Training for beginners. But wait! We've got some high-in-demand Salesforce courses for you to take your Salesforce skills to the next level, making you a desired professional in the Salesforce job market.

Comments
  • Iesha 10 Mar, 2023 at 10:52 pm

    Hello I am so excited I found your blog, I really found you by mistake, while I was searching on Yahoo for something else, Anyhow I am here now
    and would just like to say thank you for a fantastic post and a
    all round thrilling blog (I also love the theme/design), I don’t have time youtube converters to mp3 read through it all at the minute but I have book-marked it
    and also added your RSS feeds, so when I have time I will be back to read much
    more, Please do keep up the awesome jo.

Post a Comment

Your email address will not be published. Required fields are marked *