Trigger Scenario-1

Basic Example with Trigger:

// Trigger Syntax: Trigger TriggerName on Sobject(Event or Events)
//                  
//                 Trigger Trigger1    on Account(before insert)
trigger Trigger1 on Account (before insert) {
for(Account a:Trigger.New)
    {
        if(a.name !='Naveen')
            a.name ='Naveen';
    }
}
// If name is not equal to 'Naveen' or whatever name you given in name field automatically Naveen Name is inserted

Comments

  1. Hi There,

    Great piece on Welcome to Salesforce News Salesforce Interview Questions, I’m a fan of the ‘flowery’ style Looking forward to more long form articles ??

    I have an hourly scheduled export using a SOQL statement that retrieves new lead records when a date is greater than xyz. This date doesn't change automatically and stays static, and if I don't change the date every day, it will continue to pull records from that initial date I entered. The problem is that it will not pull in new records unless I change the date. This has become sort of a chore to do every day.

    I look forward to see your next updates.

    Gracias,
    Preethi.

    ReplyDelete

Post a Comment

Popular posts from this blog

Page Layouts

SOQL Scenario-1