Call Apex Through Process Builder

So today I will post how to call apex Class through Process Builder. Sometimes there is a requirement when we need to apex class through Process Builder.

Apex Class :

Public class InvokeClassThroughProcessbuilder
    @InvocableMethod(label='Get Lead Name')
    Public static void LeadUpdatefromProcessBuilder(List <ID> LeadIds ){
    Set<Id> leadId= new Set<Id>();
    List< Lead > leadtoUpddate = new List< Lead >();
    For (Lead objLead : [Select id,Status,Primary__c FROM LEAD WHERE ID IN : leadId])
        objLead.Primary__c = 'Yes';
        update leadtoUpddate;

Screenshot For Process builder :

Output :

Hope this helps 🙂

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s