Skip to main content
1 of 2
Joca
  • 941
  • 7
  • 15

Try this:

...
// Omitted first 8 lines
Map<Id, Case> newCases = new Map<Id, Case>([SELECT Product__r.Name FROM Case WHERE Id IN :Trigger.NEW]);
for(Integer i =0; i< Trigger.size; i++){
     if(Trigger.isUpdate){

        Boolean condition = Trigger.new[i].IsClosed;
        condition = condition &&(newCases.get(Trigger.new[i].Id).Product__r.Name == 'PropelSEARCH'); // Id 01td0000000yFguAAE is for PropelSEARCH product
        condition = condition && (Trigger.old[i].Campaign_End_Date__c != Trigger.new[i].Campaign_End_Date__c);
// The rest of your trigger code
...

and the product that you create for your test should be:

Product2 testProduct = new Product2(Name = 'PropelSEARCH');
insert testProduct;
Case testCase = new Case(Product__c = testProduct.Id);
Joca
  • 941
  • 7
  • 15