• Fares Alsyoufi
  • NEWBIE
  • 0 Points
  • Member since 2016


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hello,

I'm new to Apex programming and I noticed this trend in building Apex triggers. Almost every trigger I saw include this code: 
//Create a set that includes all the account ids
Set<Id> AccIds=new set<Id>();
/*Go through a list of accounts and assign Ids (generated in the set) to all account rows in the list*\
    for(Account a:trigger.new)
    {
    AccIds.add(a.Id);
    }
//Also why do you always use trigger.new method?

A detailed explanation would be highly appericiated?

Thanks,
Fares.
I have created a process on process builder that checks for certain critiera. IF criteria is met then process assigns task to one of the account managers. Because of the limitations with process builder, I haven't be able to run this process periodacly as I wish. The trigger in process builder is limited to Create or Update records..

Can someone walk me through how build such a trigger in Apex? 

Thanks,
Fares Alsyoufi.
Hello,

I'm new to Apex programming and I noticed this trend in building Apex triggers. Almost every trigger I saw include this code: 
//Create a set that includes all the account ids
Set<Id> AccIds=new set<Id>();
/*Go through a list of accounts and assign Ids (generated in the set) to all account rows in the list*\
    for(Account a:trigger.new)
    {
    AccIds.add(a.Id);
    }
//Also why do you always use trigger.new method?

A detailed explanation would be highly appericiated?

Thanks,
Fares.