• Denise Flood
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
Hi
I was wondering if anyone can help me with test class for the trigger below

trigger createNewRecord on Audits__c (after update){
   list<Audits__c> newList = new list<Audits__c>();
 
   for (Audits__c p:Trigger.new){
  
     if ((p.Closed_Date__c!=trigger.oldMap.get(p.ID).Closed_Date__c)&(p.Closed_Date__c==Date.today())){
      
        Audits__c au = new Audits__c(Name=p.name,Frequency__c=p.Frequency__c,Date__c=p.Closed_Date__c,Account__c=p.Account__c,Status__c='Opened');
        newList.add(au);
     }
   }
   if(newList.size()>0)
   {
      insert newList;
   }    
}

Thanks
Hi 
I was wondering if anyone can help me with test class for the trigger below

trigger createNewRecord on Audits__c (after update){
   list<Audits__c> newList = new list<Audits__c>();
  
   for (Audits__c p:Trigger.new){
   
     if ((p.Closed_Date__c!=trigger.oldMap.get(p.ID).Closed_Date__c)&(p.Closed_Date__c==Date.today())){
       
        Audits__c au = new Audits__c(Name=p.name,Frequency__c=p.Frequency__c,Date__c=p.Closed_Date__c,Account__c=p.Account__c,Status__c='Opened');
        newList.add(au);
     }
   }
   if(newList.size()>0)
   {
      insert newList;
   }     
}

Thanks
Hi 

I am trying to set up a trigger for the following:

Create a new record in a custom object called Audit when a previous record is marked closed.
The Name of the new record would be called Account Name(linked to the account on the previous record) - Audit - Date Created.


How would it be recommended that I complete this task?

Thank you
Hi 
I was wondering if anyone can help me with test class for the trigger below

trigger createNewRecord on Audits__c (after update){
   list<Audits__c> newList = new list<Audits__c>();
  
   for (Audits__c p:Trigger.new){
   
     if ((p.Closed_Date__c!=trigger.oldMap.get(p.ID).Closed_Date__c)&(p.Closed_Date__c==Date.today())){
       
        Audits__c au = new Audits__c(Name=p.name,Frequency__c=p.Frequency__c,Date__c=p.Closed_Date__c,Account__c=p.Account__c,Status__c='Opened');
        newList.add(au);
     }
   }
   if(newList.size()>0)
   {
      insert newList;
   }     
}

Thanks
Hi 

I am trying to set up a trigger for the following:

Create a new record in a custom object called Audit when a previous record is marked closed.
The Name of the new record would be called Account Name(linked to the account on the previous record) - Audit - Date Created.


How would it be recommended that I complete this task?

Thank you