function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Leo DarkstarLeo Darkstar 

Do I need an @InvocableMethod on the 2nd method of a class ?

I'm calling a class through the Process Builder. It has two methods within it, with one having using a @Future method being used on it. I'm using the @InvocableMethod on the first method of the class in order to be able to call it from a Proc Builder. But I didn't use it on the method, and I'm not seeing that method in my debugs. At first I thought maybe it was because it had a @Future annotation on it, but I'm seeing other FutureHandlers in the debug, so I'm guessing that's not it. 

 

Do I need to use another @InvocableMethod with that method as well ? If so, is it even possible to use an @InvocableMethod on a method which already has a @Future associated with it ? 

 

Here is that method at the end of the class. I'm not including the entire class because I want to try and keep it simple, but if you think I need to include that as well I can do that. 

 

@future(callout=true) 
    public static void pardotCallout(String contactId) {
                
        String returnedResponseFromPardot = Http_Utility_Pardot.pardotCreateProspect(new Set<Id> {contactId});
        System.debug('TESTER DEBUGGER-POST-FUTURE2');        
        }

Any help you can provide will be very appreciated. 
AnudeepAnudeep (Salesforce Developers) 
As far as I know, we need to declare a method as @InvocableMethod to be able to call it from a process builder
 
public class DeleteUnacceptedQuotes
{
    @InvocableMethod
    public static void QuoteDelete(List OpportunityIds)
    {
        List Quotes =[select id from quote
                          where Opportunity.id in :OpportunityIds
                       and Status != 'Accepted'];
        delete Quotes;
   }
}

If you want to call a future method from process builder, it should be like this
 
public class LightningProcessBuilder {
    @InvocableMethod 
    public static void sendEmailToOwner(List<String> listUserNames) {
        callEmailSend(listUserNames);
    }
    @future
    public static void callEmailSend(List<String> listUserNames) {
        //Write the logic.
       //If it is a call out, use callout = true in future annoation
    }
}