• Fernando Glingani
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Can't find apex class with invocable method in Process Builder on production org. On develop org it works fine.
User-added image
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) {
    }
}