Questions tagged [callout]

"HTTP Callouts" connect to a remote web server from Apex code.

Filter by
Sorted by
Tagged with
0 votes
1 answer
16 views

blob is not a valid utf-8 string error [duplicate]

String body = '' + documentList[0].VersionData+ ''; system.debug('body---'+body); HttpRequest req = new HttpRequest(); req.setBody(body); req.setHeader('Content-Type','multipart/form-data; boundary='+...
user avatar
0 votes
1 answer
33 views

Hello there this is my Trigger on Account and have to convert this code for mass usage using batch class can anyone help with that?

trigger AccountTrigger001 on Account (after insert, after update) { if(trigger.isInsert == true && trigger.isAfter == true){ AccountTriggerHelperClass001.accData(trigger.new); }...
user avatar
-1 votes
0 answers
30 views

Callout Test Class failing during deployment [closed]

I have created a test class using StaticResourceCalloutMock mock response. THis is working fine in preprod but when I deploy it in production it gives error. this comes when we try to process the ...
user avatar
0 votes
0 answers
13 views

PostScript Install not sending e-mails after failed callout

I have created a post-install script that sends a request to a web server. If the server response's status code is not 204, the script should send an e-mail alerting me about that. The problem is that ...
user avatar
0 votes
0 answers
25 views

Flow with a callout: how to avoid System.CalloutException: You have uncommitted work pending [duplicate]

I am creating a very basic flow. It is set that when record is updated and 1 specific condition is met that it will call an apex action that will call an api. I have set it up and the code is below ...
user avatar
  • 127
0 votes
0 answers
48 views

Apex Rest callout error - PKIX path building failed (Cert issue from Entrust)

I got issue when making outbound API Call from sfdc. PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target ...
user avatar
  • 21
2 votes
1 answer
82 views

My Org's IP address is not in the given IP Range

The list of IP ranges to be whitelisted are (as far as I know the followings): https://help.salesforce.com/s/articleView?id=000321501&type=1 - however my call is sent out from an IP Address (check ...
user avatar
2 votes
2 answers
244 views

why am i getting : Invalid conversion from runtime type List<ANY> to Map<String,ANY>

I am trying to parse data that I get from an external webservice with a get api callout. When running the code I get the error : Line: 14, Column: 1 System.TypeException: Invalid conversion from ...
user avatar
0 votes
1 answer
47 views

How to test schedulable class with future callout method

I'm trying to run this test and it keeps failing. The error I'm getting is "System.QueryException: unexpected token: 'null'" so it's related to my lstContacts SOQL query, but I can't figure ...
user avatar
  • 15
0 votes
0 answers
54 views

Error "Refused to connect to" when calling Rest API from LWC

I want to make a REST API call from my LWC but when I make the callout I get this error Refused to connect to 'XXXXXXX' because it violates the following Content Security Policy directive: "...
user avatar
0 votes
1 answer
34 views

Is Apex Callout chaining from Javascript controller using Async/await or Promise possible?

I need to make 5 callouts serially. I have written 5 different apex classes. I want to chain these callouts from JavaScript controller using Async/Await or Promises. Had anyone worked on such scenario?...
user avatar
1 vote
1 answer
48 views

"Variable does not exist" error where variable is a class does exist

I have an Apex class OpportunityUpserter with a static method, where the static method makes a call to another static method in a class called IntegrationUtilities, as shown below. This gives me a ...
user avatar
  • 113
0 votes
1 answer
49 views

Apex Class CallOut

I'd like to apologize in advance as I'm quite new to writing APEX Classes / Triggers. I've followed a tutoriel of which the aim is to POST a comment to an external system, in this case it's Jira. I ...
user avatar
0 votes
0 answers
29 views

Getting full coverage for test class for boolean value? [duplicate]

This UserMigrationRoute class is migrating Community profile users to Partner profile and saving their username Password in userMigration object. I have really hard time writing test classes. I have ...
user avatar
1 vote
0 answers
102 views

Named Credentials with JWT Token Exchange: problem with "subject_token"

I was trying to setup a Named Credentials with JWT Token Exchange (i.e. not the basic "JWT" option) to use GCP Identity Federation and I got this error when doing an APEX Http callout: ...
user avatar
  • 111
4 votes
1 answer
65 views

Flow -> Apex -> Salesforce REST API: why "Unauthorized endpoint"?

I have an Apex class that calls into Salesforce using a new HttpRequest(). When I call that Apex from Anon Apex, it works fine. But when I call it from a Flow I am testing in FlowBuilder, it complains ...
user avatar
0 votes
0 answers
37 views

Using username and password properties from named credentials to create an access token for x-authorization header

I'm using named credentials to make a callout, I'm not using the Generate Authorization Header since the authorization uses an x-authentication header. I have tried this: aeroplanCallout....
user avatar
  • 252
0 votes
0 answers
40 views

Trying to Create a Feed Using an External Callout Using Chatter API

What works: All three files are communicating with each other The lightning button calls handleClick() handleClick() gets the return value of getFeedElements() getFeedElements(any given record ID) ...
user avatar
0 votes
0 answers
38 views

How to get 100% test coverage for an apex trigger associated with an asynchronous callout?

I am looking for assistance on why 'zipCodeTimeZone.makeCallout(objLead.Id)' in both places on the trigger is not being covered/triggered by my test method while it is providing 100% coverage for the ...
user avatar
  • 1
2 votes
1 answer
87 views

Queueable HttpCallout.TooManyCalloutsException: Too many callouts requested vs SFDC Limit: 0

I have a Queueable class that performs a single callout. When it executes, it generates this error: HttpCallout.TooManyCalloutsException: Too many callouts requested vs SFDC Limit: 0 public class ...
user avatar
  • 63k
1 vote
1 answer
160 views

Named Credential with OAuth Authentication Provider does not refresh access token

This is an extremely annoying unsolved issue that I see more people than I have been, and are(?), struggling with without a solution to date. Please help! Workaround or guidance. Auth Provider (AP): ...
user avatar
  • 11
0 votes
1 answer
175 views

Future Callout and Invocable Apex

I have an invocable apex method that calls to a future (callout=true) method. The callout returns a response that needs to be returned to the front end. I am stuck because I can't return a value from ...
user avatar
  • 3,181
1 vote
2 answers
114 views

Named Credential - using a merge field

Im facing issues trying to generate the auth header in Apex when using Named Credentials. Unfortunately I cannot use the standard Named Credential approach (auto header generation) as I have to embed ...
user avatar
  • 13
0 votes
1 answer
29 views

How to properly test and assert an @restresource that do multiple API calls?

I am struggling to do a test class, mainly building a proper assert method based on the following @RestResource (at the end). This class have 3 different API calls (First API response an XML the other ...
user avatar
  • 1,889
2 votes
0 answers
93 views

Platform Event + Flow + Apex Action not behaving as a separate transaction sometimes

As we have used Async operations (Future and Queueable) very heavily in our codebase. Thus for doing callouts from trigger, I started using Platform Events + Flow. So from Trigger a PE will be raised :...
user avatar
0 votes
0 answers
50 views

ApexPages.getContent() Callout Error from Flow

I am receiving the following error when I run the below apex invocable method in my flow: An Apex error occurred: System.CalloutException: You have uncommitted work pending. Please commit or rollback ...
user avatar
0 votes
0 answers
64 views

I am trying to delete account record using Postman tool. I have created apex class and method to delete account. but the account doesnt get deleted

@RestResource(urlmapping='/v1/Account/*') global class AccountManager { @httpDelete global static String deleteAccount(){ RestRequest request = RestContext.request; String requestURI = ...
user avatar
0 votes
0 answers
32 views

On which side is the root of this issue

After callout with using a certificate, I receive the next msg in my dev console - System.CalloutException: Received fatal alert: bad_certificate Could you pls specify from what side we have a problem ...
user avatar
  • 21
-1 votes
1 answer
195 views

is it possible to add uri parameters on a http callout using named credentials?

Context: I have to call, from a source org, a HttpGet method from a target org. This method will return a list of records that match a certain value on a field, which I have to send from my source org....
user avatar
-2 votes
1 answer
183 views

Http POST/PUT data via LWC or VF

I would like some help in using a LWC or Visualforce page form to populate fields in a wrapper and then eventually post the inputs using a http 'Put' request. Expected json: { "...
user avatar
0 votes
0 answers
36 views

JKS certificate chain in call out

I am trying to make a callout based on provided JKS but received - a bad certificate. No one from the customer side can not fix it. What documentation do I need to provide for a person who tries to ...
user avatar
  • 21
0 votes
1 answer
84 views

After response from future callout how we can update the field value in record, can you please assist

here I'm calling below class from the trigger and getting response from external system as well whether my regNo is blacklisted or not, but after saving the record how we can update the status basis ...
user avatar
  • 11
0 votes
0 answers
35 views

Stub method from another class

I have stubbed class with name DataUtils and class which i am testing with name DataController. Method from DataUtils that is being called in DataController is web service callout. I cannot use ...
user avatar
  • 41
0 votes
0 answers
86 views

Bad certificate in call out

I use the certificate provided to me. During callout, I get this message in the developer console. Is this a bug on the side of SF or an external system? How can I verify the correctness of the ...
user avatar
  • 5
0 votes
0 answers
35 views

Troubleshoot Platform Event in Production Environment

We have an existing implementation where Flow 1 publishes the event and Flow 2 subscribes to the same event and processes the apex logic. The apex logic includes callout and updating the Lead. Out of ...
user avatar
1 vote
1 answer
182 views

Named Credential Permission Error - How to enable named credentials with "Named Principal"

I've got a new named credential setup using an OIDC auth provider and the named principal type. It's authenticated successfully but when I try to call it I get String namedCredential = 'callout:asdf'; ...
user avatar
0 votes
1 answer
21 views

Test for three callouts in one Queueable class

I have 2 callouts in one class. I use XML mock in static resources. How to provide the right fake XML to every callout? Thank you public with sharing class x implements Queueable, Database....
user avatar
  • 5
0 votes
0 answers
197 views

External callout using Flow Builder - Apex Class Invocable Action

I would like to create a callout (webhook) when a custom field Batch_Name__c is updated which belongs to the Account Object. The purpose of this callout is to send all account information to an ...
user avatar
  • 1
0 votes
1 answer
110 views

Callout using Apex Trigger when custom field updated

I would like to create a callout (webhook) when a custom field Batch_Name__c is updated which belongs to the Account Object. The purpose of this callout is to send all account information to an ...
user avatar
  • 1
0 votes
1 answer
43 views

429 status code if I make call outs in Batch execute

From a batch apex I am trying a make a call out in for loop as like below for(eBilling__c bill : lstBilling){ try { HttpRequest req = new HttpRequest(); ...
user avatar
  • 59
1 vote
0 answers
68 views

Scheduled Job Is Not Running

I have written a REST API request that passes the response body to a class to deserialize it into a wrapper class. That rapper class then passes a list of records into a batch class incrementally so ...
user avatar
  • 13
0 votes
1 answer
89 views

I try to do callout to my apex rest service from first to second dev org, but got CalloutException

String endPoint = 'https://wise-otter-ngj5eu-dev-ed.salesforce.com/services/apexrest/v1/getAccounts/'; Http h2 = new Http(); HttpRequest req1 = new HttpRequest(); req1.setHeader('Authorization','...
user avatar
  • 13
0 votes
0 answers
239 views

LWC: Trying to get Access token

I am trying to get an access token from parent salesforce org. Here is the code which I am using: fetch('https://test-dev-ed.my.salesforce.com/services/oauth2/token', { ...
user avatar
  • 679
1 vote
1 answer
66 views

PUT method of @future(callout=true) gives us 403 Forbidden error for the added remote site

I'm working on the trigger for the custom object, when we update the custom mail field, it has to be updated in the third party api(Which I've added in the remote site settings). As we know @future(...
user avatar
0 votes
2 answers
143 views

queuable apex with more than 100 callouts

I am inserting more than 100 lead records via Data Import Wizard. I have the following trigger: if(Trigger.isAfter && trigger.isInsert){ if(Trigger.new != null){ system....
user avatar
  • 41
0 votes
0 answers
55 views

calling a post request with json given as params in the apex callout

our requirement is to call the post method in the apex class passing the json and the credentials dynamically. I have used a json wrapper class to parse the json. I need help in how to write a callout ...
user avatar
1 vote
1 answer
140 views

LWC - callouts from javascript controller or from Apex class?

I tried searching the differences between making callouts from LWC javascript controller or from Apex Class. Simple scenario is displaying an array of data in a datatable in a LWC. Are there any ...
user avatar
0 votes
1 answer
174 views

SSJS API call with form-data Content-Type

I am trying to make a request to an external API with SSJS and I have found this post where Eliot Harper posted a solution. I have made a lot of API calls using SSJS but with Content-Type JSON. Now I ...
user avatar
  • 31
0 votes
1 answer
1k views

Apex REST API GET method with request body?

How do you do a HttpRequest for a GET method with a request body? For some reason this GET method is getting converted to POST and is not successful. This is working via postman. Http http = new Http(...
user avatar
  • 392
0 votes
1 answer
129 views

Setting up a named credential for Salesforce REST Web Service

I'm learning integrations and found out about named credentials. I want to set a named credential for my Apex method which performs a callout to my scratch org: @AuraEnabled(cacheable=true) public ...
user avatar

1
2 3 4 5
24