+ Start a Discussion
Alaric WimerAlaric Wimer 

Invocable method not appearing in Process Builder

Does anyone know why my invocable method is not appearing in my Process Builder's list of Apex Classes?

 

Some extra info: I also have a test class with 100% code coverage as well. Any help is greatly appreciated.

 

Here's my class with the invocable method :

 

public class ContactFunnelToSQL {
    @InvocableMethod(label='Contact Funnel to SQL' description='Updates the Funnel to SQL for Opportunity Contact Roles')
    public static void oppContactsToSql(List<Opportunity> myOppsToUpdate) {
      
        List<Opportunity> myOpps = [
            SELECT Id
              FROM Opportunity 
             WHERE Id IN :new Map<Id, Opportunity>(myOppsToUpdate).keySet()
        ];

        Set<Id> oppIds = new Set<Id>();
            
        // Add Opportunity Ids to a set for querying later
        for (Opportunity opp : myOpps){
            if (opp.Id != null) {
                oppIds.add(opp.Id);
            }
        }

        if (oppIds.size() > 0) {    
            // Get the Contact Ids from the Opportunity Contact Roles
            List <OpportunityContactRole> ocrs = [
                SELECT ContactId
                  FROM OpportunityContactRole
                 WHERE OpportunityId IN :oppIds
            ];
            
            if(ocrs.size() > 0) {       
                
                Set<Id> contactIds = new Set<Id>();

                // Add the Contact Ids to a set for querying later
                for (OpportunityContactRole ocr : ocrs) {
                    if (ocr.ContactId != null && !contactIds.contains(ocr.ContactId)) {
                        contactIds.add(ocr.ContactId); 
                    }
                }

                // Get the Opps' Contacts that are not already in SQL, Won, or Disqualified
                List<Contact> oppContacts = [
                    SELECT Id, Funnel__c, Funnel_Status__c, SQL_Reached__c
                      FROM Contact
                     WHERE Id IN :contactIds 
                       AND Funnel__c != 'SQL'
                       AND Funnel__c != 'Won'
                       AND Funnel__c != 'Disqualified'
                ];

                if (oppContacts.size() > 0) {
                    List<Contact> contactsToUpdate = new List<Contact>();

                    // Set the Contacts' funnels to SQL
                    for (Contact oppCon : oppContacts) {
                        oppCon.Funnel__c      = 'SQL';
                        oppCon.SQL_Reached__c = true;
                        contactsToUpdate.add(oppCon);
                    }

                    if (contactsToUpdate.size() > 0) {
                        update contactsToUpdate;
                    }
                }
            }
        }
    }
}
Best Answer chosen by Alaric Wimer
Alaric WimerAlaric Wimer
Looks like I just needed to recreate the class with a slightly different name and method name. Then I copied the code over to the new class and deleted the old one. Now it appears in Process Builder. Problem solved. Anyway, thanks for your reply Danish.

All Answers

Danish HodaDanish Hoda
Hi Alaric,

I assume you are searching for oppContactsToSql method, instead of ContactFunnelToSQL class. Process builder lists down the class names which have invocable methods in it.
Alaric WimerAlaric Wimer
Looks like I just needed to recreate the class with a slightly different name and method name. Then I copied the code over to the new class and deleted the old one. Now it appears in Process Builder. Problem solved. Anyway, thanks for your reply Danish.
This was selected as the best answer
disnyyz disnyyzdisnyyz disnyyz
Disney Hub is the system situated entrance started by the organization. This has helped its workers to get to the necessary data effectively from any edge of the world and get profited.   disney hub login (https://disneyhubloginx.com)The records can be overseen separately by the representatives and can plan their work with the assistance of Disney Hub online administrations.
 
globalsubwnsz globalsubwnszglobalsubwnsz globalsubwnsz
The client needs to go to https://www.globalsubwaylistensx.com This site is set up by Subway itself with the goal that clients can fill in their input about the items and administrations of the tram. Fill Your subtleties on the landing page as demonstrated as follows.