• TibUbq
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I've come across a trigger in our system but i'm not sure what it's doing? Could anyone take a look and see if they can break down what exactly it's doing?

trigger Trigger_Name on Account (after insert) {

    Class_Name CN1 = new Class_Name();
    CN1.Account_Link(Trigger.new);       
}   
 
public with sharing class Class_Name {
public void Account_Link(list<account> acs){
    list<account> marked_acs = new list<account>();
    for(Account ac : acs){
        if(ac.industry == 'Link'){
             marked_acs.add(ac);
        }
     }     
    list<Account_Link__c> Link_acs = new list<Account_Link__c>();
    for(Account ac : marked_acs){
Linked_Account__c con_ac = new Linked_Account__c(name = ac.name, account__c = ac.id);
Linked_acs.add(con_ac);
        }
        insert Linked_acs;       
    }   
}
 
  • December 12, 2018
  • Like
  • 0