You need to sign in to do that
Don't have an account?
Valentina Ermilova
Can't find apex class with invocable method in Process Builder on production org
Can't find apex class with invocable method in Process Builder on production org. On develop org it works fine.
I tryed recompile all classes, it did not help. Class successfuly pass test. Please, what can be wrong?
I tryed recompile all classes, it did not help. Class successfuly pass test. 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) { } }
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!
All Answers
Please follow the below steps.
- Locate the Apex Class
- Go to Develop | Apex Classes | <Your Apex Class>
- See if the Status says it is active. If not, next step
- Use Developer Console or Setup | Develop | Apex Test Execution and run the tests for that class.
This will make the class active and available for use in Process Builder.Please let me know if this helps your problem. Thanks.
Regards,
Sudipta Deb.
Thanks for idea. Class already is active, but still isn't availiable if Process Builder.
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!
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
I have no tests for 1 class that DOES show up ok in PB and Flow (created last night).
Basically copied that one, changed some things in class- 2nd one does not show up.
Tried @Yahor Volkau's compile all classes steup. Finished. No change.
@InvocableMethod(label='Convert Leads')
It will not appear in the process builder .
But if you use simply
@InvocableMethod
It will work.
Thanks,
Gopal Singh
PS. I have tried what @Valentina and @Gopal Singh sugestions.
Regards
Fernando
I have faced same issue while creating new Update Opportunity process to call an Apex action (named Post Opportunity To PMS) to pass Integration superbadge's 3rd challenge.
just need to update/add @InvocableMethod annotation for method postOpportunityToPMS() of class ProjectCalloutService.
Thank you.