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
Stefano AmentaStefano Amenta 

Can't find apex class in Process Builder

Hi,

I wrote a class for an API integration.

I'm trying to fire the class via Process Builder, however, I'm unable to find my class in the action section of the Process.

Do you know why?

I followed the documentation about InvocableMethod here: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm

The class is Active and I also recompiled it, but no effect.

Do you know why I can't find it?
 
global class AmbassadorCommissionUpdate {   
    global Integer isApproved {get;set;}
    
    global AmbassadorCommissionUpdate (){         
            isApproved = 1;             
                
    }
    
  @InvocableMethod (label='Ambassador Commission Update')
  global static void fireCall (List<Id> ContactIds) { 
        String transactionId;
        String userName;
        String token;
        Id contactId = ContactIds[0];
        Contact acc = [SELECT Id FROM Contact WHERE Id=: contactId];
        transactionId = acc.Id;
        if( !String.isBlank(transactionId) ) { 
            system.debug('ambassador firing ***');
            Http h = new Http();
            HttpRequest req = new HttpRequest();            
            req.setEndpoint('https://getambassador.com/api/v2/' + userName + '/' + token + '/json/commission/update/');
            req.setMethod('GET');
            req.setBody(JSON.serialize(new AmbassadorRequest(transactionId, 1)));
            HttpResponse res = h.send(req);
            }           
        }   
        
    global class AmbassadorRequest {
        String transaction_uid;
        Integer is_approved;
        
        global AmbassadorRequest(String tId, Integer isApproved) {
            this.transaction_uid = tId;
            this.is_approved = isApproved;
        }
    }     
}



 
Raj VakatiRaj Vakati
I am able to see the same class .. 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm


Is its from the managed package ??An invocable method can be public in a managed package, but it won’t appear as an action in the Cloud Flow Designer’s list of available actions while building or editing a flow. These invocable actions can still be referred to by flows within the same managed package. Global invocable methods in a managed package can be used in flows outside the managed package, anywhere in the organization, and appear in the Cloud Flow Designer’s list of available actions to add to a flow.

So with global invocable methods and global invocable variables all works on production.

 
Stefano AmentaStefano Amenta
Hi Raj

thanks for the answer.

The class is not part of a managed package.

I haven't tried in Production yet, but in Sandbox I'm unable to find the class, either it's public or global...