You need to sign in to do that
Don't have an account?
@InvocableMethod Class not making call to Endpoint
I have a process that invokes an @InvocableMethod Class, which should post to an endpoint. I am not getting any errors, but it isn't making the call. My Class is below. What am I missing? Any help is appreciated. Thank you!
global class SalesCloudOnboardCustomerClass {
@InvocableMethod(label ='Call Sales Cloud' description='Sends the Opportunity Id to Sales Cloud.')
public static void makeCallout(List<Id> ids) {
System.debug('DebugMe ids: ' + ids);
String endpoint='';
HttpRequest request = new HttpRequest();
// Set the HTTP verb to POST.
request.setMethod('POST');
for(Id id : ids){
//Set the endpoint URL.
Remote_Endpoint__mdt onboardCustomer = [select Endpoint__c from Remote_Endpoint__mdt where QualifiedApiName = 'OnboardCustomer' Limit 1];
endpoint = onboardCustomer.endpoint__c + id;
}
// Set the endpoint URL.
request.setEndPoint(endpoint);
// Set timeout to 40 seconds.
request.setTimeout(40000);
// Send the HTTP request and get the response.
System.debug('DebugMe request: ' + request);
//HttpResponse response = new HTTP().send(request);
}
}
global class SalesCloudOnboardCustomerClass {
@InvocableMethod(label ='Call Sales Cloud' description='Sends the Opportunity Id to Sales Cloud.')
public static void makeCallout(List<Id> ids) {
System.debug('DebugMe ids: ' + ids);
String endpoint='';
HttpRequest request = new HttpRequest();
// Set the HTTP verb to POST.
request.setMethod('POST');
for(Id id : ids){
//Set the endpoint URL.
Remote_Endpoint__mdt onboardCustomer = [select Endpoint__c from Remote_Endpoint__mdt where QualifiedApiName = 'OnboardCustomer' Limit 1];
endpoint = onboardCustomer.endpoint__c + id;
}
// Set the endpoint URL.
request.setEndPoint(endpoint);
// Set timeout to 40 seconds.
request.setTimeout(40000);
// Send the HTTP request and get the response.
System.debug('DebugMe request: ' + request);
//HttpResponse response = new HTTP().send(request);
}
}
https://salesforce.stackexchange.com/questions/120012/problem-with-process-builder-invocable-method-and-webservice-call-out
All Answers
Is it printing debug statements?
16:03:54.558 (564622195)|USER_DEBUG|[23]|DEBUG|DebugMe request: System.HttpRequest[Endpoint=https://salescloudxxxxxxxxx.com/onboard/new/0070S000002iTvaQAA, Method=POST]
Debug Log ends with this:
16:03:54.558 (564699649)|CODE_UNIT_FINISHED|SalesCloudOnboardCustomerClass.makeCallout 16:03:54.552 (564964629)|FLOW_START_INTERVIEWS_END|1 16:03:54.492 (565484567)|WF_FLOW_ACTION_END|06L0S0000002KZv 16:03:54.492 (565649955)|WF_TIME_TRIGGERS_BEGIN 16:03:54.492 (582697551)|WF_ACTIONS_END| Flow Trigger: 5;
https://salesforce.stackexchange.com/questions/120012/problem-with-process-builder-invocable-method-and-webservice-call-out
See below apex code where I have implemented your provided apex callout in a future method.