You need to sign in to do that
Don't have an account?
Alaric 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; } } } } } }
All Answers
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.