1

Can't find apex class with invocable method in Process Builder on production org. On develop org it works fine.

enter image description here Please, what can be wrong?

global class SearchObjectWhenCreate {

global class Request {
    @InvocableVariable
    public String objectId;
    @InvocableVariable
    public String searchType;
}

@InvocableMethod
public static void searchObject(List<Request> requests) {

    SearchButtonsController searchButtonsCtrl = new SearchButtonsController();
    List<verf__VF_Search__c> listOfSearches = new List<verf__VF_Search__c>();

    if (Schema.sObjectType.VF_Search__c.fields.Id.isAccessible()){
        listOfSearches = [SELECT Id
                        FROM verf__VF_Search__c
                        WHERE Name =: requests[0].searchType
                        LIMIT 1];
    }
    if(!listOfSearches.isEmpty()){
        searchButtonsCtrl.vf_searchId = listOfSearches[0].Id;
        searchButtonsCtrl.strObjectId = requests[0].objectId;
        searchButtonsCtrl.getObjectInfo();
        searchButtonsCtrl.isCalledFromProcessBuilder = true;
        searchButtonsCtrl.searchRequest();
        request(searchButtonsCtrl.xmlStringxmlRes, searchButtonsCtrl.vf_searchName);
    }
}

@future(callout=true)
public static void request(String xmlStringxmlRes, String searchName) {
    Http httpProtocol = new Http();
    HttpRequest request = new HttpRequest();
    HttpResponse response = new HttpResponse();
    String body = 'request=' + xmlStringxmlRes;

    String endpoint = 'https://viqzrh5hp3.execute-api.us-east-1.amazonaws.com/verified_first';
    request.setEndPoint(endpoint);
    request.setBody(body);
    request.setMethod('POST');

    try {
         if(!Test.IsRunningTest()){
            response = httpProtocol.send(request);
            parseXMLResponce(response.getBody(), searchName);
        }
    } catch(System.CalloutException e) {
    }
}
5
  • Have you tried recompiling your apex classes? Via Setup -> apex classes -> Compile all classes (top left)
    – pjcarly
    Jun 3, 2016 at 14:46
  • Thanks for idea, I performed recompiling. But it did not help.
    – Colombo
    Jun 3, 2016 at 14:54
  • It happened with me as well, my class name is "invokeFreezeAccount", However in process builder it was showing name as "FreezeAccount" It will be good if you contact Salesforce Support.
    – C0DEPirate
    Jun 3, 2016 at 15:31
  • try run tests for the class in question in PROD
    – cropredy
    Jun 3, 2016 at 18:03
  • Class successfuly passed test.
    – Colombo
    Jun 7, 2016 at 16:55

2 Answers 2

3

From documentation:

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. Solution was found. Thanks to all!

2

I had the similar problem, but fixed it for public class: 1) close Process Builder 2) go to Setup / Develop / Apex Classes and click "Compile all classes" ​3) go to your process and select your class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.