• Zaki K
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi all.

here is my code . how can i achieve 100% code coverage for this Trigger?



trigger CopyAttachments on SVMXC__Service_Order__c(after insert)
{
 //Attachment[] attList = [select id, name, body from Attachment where ParentId = :Trigger.new[0].SVMXC__Case__c];
 Attachment[] insertAttList = new Attachment[]{};
 
         for(Attachment a: [select id, name, body from Attachment where ParentId = :Trigger.new[0].SVMXC__Case__c])
         {
               Attachment att = new Attachment(name = a.name, body = a.body, parentid = Trigger.new[0].id);
               insertAttList.add(att);
         }
       if(insertAttList.size() > 0)
       {
            insert insertAttList;
       }
 
}
  • November 16, 2016
  • Like
  • 1
Hi all.

here is my code . how can i achieve 100% code coverage for this Trigger?



trigger CopyAttachments on SVMXC__Service_Order__c(after insert)
{
 //Attachment[] attList = [select id, name, body from Attachment where ParentId = :Trigger.new[0].SVMXC__Case__c];
 Attachment[] insertAttList = new Attachment[]{};
 
         for(Attachment a: [select id, name, body from Attachment where ParentId = :Trigger.new[0].SVMXC__Case__c])
         {
               Attachment att = new Attachment(name = a.name, body = a.body, parentid = Trigger.new[0].id);
               insertAttList.add(att);
         }
       if(insertAttList.size() > 0)
       {
            insert insertAttList;
       }
 
}
  • November 16, 2016
  • Like
  • 1