You need to sign in to do that
Don't have an account?
Illegal variable
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;
}
}
Hi Bob...thanks for the update. This is the error message I get when I tried your code above. The Web_Campaign is a custom object included in the Salesfusion app.
Error: Compile Error: sObject type 'Web_Campaign__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 6 column 44
public class DeleteEmailCampaigns
{
@InvocableMethod
public static void WebCampaignDelete(List<Id> webCampaignIds)
{
List<salesfusion__Web_Campaign__c> webCampaigns =[select id from salesfusion__Web_Campaign__c
where salesfusion__Web_Campaign__c.id in :webCampaignIds
and Days_Since_Creation__c > 90];
delete webCampaigns;
}
}