• Samantha Starling 18
  • NEWBIE
  • 0 Points
  • Member since 2017

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

I'm building a flow that is going to call on a tiny bit of Apex where I need it to delete the Email Campaign record once it's greater than 90 days old. I copied and modified from the original apex replacing quotes with my object. I'm getting error messages for illeglal variables around the salesfusion_web_campaign. Anyone spot what I'm doing wrong?

Here's the article I'm using as a guide: https://automationchampion.com/tag/auto-delete-record-using-process-builder/

ORIGINAL APEX>
public class DeleteUnacceptedQuotes
{
    @InvocableMethod
    public static void QuoteDelete(List<Id> OpportunityIds)
    {
        List<Quote> Quotes =[select id from quote
                          where Opportunity.id in :OpportunityIds
                       and Status != 'Accepted'];
        delete Quotes;
   }
}

MY CUSTOM APEX VERSION 1>
public class DeleteEmailCampaigns
{
   @InvocableMethod
   public static void WebCampaignDelete(List<Id> salesfusion__Web_Campaign__c.Ids)
   {
       List<Web_Campaign__c> Web_Campaign__c =[select id from Web_Campaign__c
                         where salesfusion__Web_Campaign__c.id in :salesfusion__Web_Campaign__c.Ids
                      and Days_Since_Creation__c > 90];
       delete Web_Campaign__c;
  }
}

MY CUSTOM APEX VERSION 2>
public class DeleteEmailCampaigns
{
   @InvocableMethod
   public static void WebCampaignDelete(List<Id> salesfusion__Web_Campaign__cIds)
   {
       List<Web_Campaign__c> Web_Campaign__c =[select id from Web_Campaign__c
                         where salesfusion__Web_Campaign__c.id in :salesfusion__Web_Campaign__cIds
                      and Days_Since_Creation__c > 90];
       delete Web_Campaign__c;
  }
}