• Mike Morrison 8
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I currently have a trigger that checks a box when an attachment is added to a custom object called "Contracts__c". I would like to expand this Trigger to only check the box if the actual attatched document includes certain keywords. Is this possible? Here is my current code:

trigger CountAttachment on Attachment (before insert, before delete)
{
if(trigger.isinsert){
List<Contracts__c> co = [select id from Contracts__c where id =: Trigger.New[0].ParentId];
If(co.size()>0)        
{            
co[0].Contract_Attached__c = True;            
update co;        
}
}


if(trigger.isdelete){

List<Contracts__c> co = [select id from Contracts__c where id =: Trigger.old[0].ParentId];        
If(co.size()>0)        
{            
co[0].Contract_Attached__c = false;            
update co;        
}
}
}