Skip to main content
6 votes
Accepted

@IsTest - How to get the RestContext.response from @HttpPost if the post method is not returning

You need to call the actual http method for it to invoke the API and then if you check, it should have the response. @IsTest static void TestBehavior() { RestRequest request = new RestRequest(); ...
metasync's user avatar
  • 1,792
4 votes

Convert response to a string

This JSON is mangled: you have a single outer key, Account, whose value is not more JSON but a string value containing escaped JSON. It would be best to fix this at the source of this JSON by ...
David Reed's user avatar
  • 93.7k
3 votes

Lightning component not returning a response

Why don't I get an update on my object ? -> null null null null Cant get create a record if your apex controlLer does not receive any values. Why dont I get a response in my lightning component? ...
glls's user avatar
  • 20.3k
3 votes
Accepted

Create a test class for RestResource class with a response code

It appears all I needed to do was add this to the test class at the start of the method (before the Account acct... line): RestRequest req = new RestRequest(); RestResponse res = new RestResponse(); ...
Irene's user avatar
  • 1,895
1 vote

External Services - Nested object in response appears to be blank in Flow but is populated in Postman

UPDATE Confirmed, the issue is with the flow mapping. In order to get it working I created a variable resource of apex-defined type, choosing the ExternalService autogenerated class, and used it in ...
Gabriel Serrano Salas's user avatar
1 vote
Accepted

Receiving no response from Salesforce on patch API call

A successful update is a 204 response. That status code means "your operation was successful, and there is no response body." If there were an error, you'd get a 4xx or 5xx status code with ...
sfdcfox's user avatar
  • 502k
1 vote
Accepted

How can I correctly build a query to get the fields of an object I need from the database?

You must use a binding by prefixing the reference to newContact.Id using a colon: @AuraEnabled public static Contact createContact(Contact newContact){ upsert newContact; return [SELECT Name, ...
Phil W's user avatar
  • 38.2k
1 vote
Accepted

Sending status code with response using apex

Welcome to Salesforce StackExchange, As I understood you have facing issue with implementation logic of error handling / Response of the request. I would prefer to User Database.insert() rather than ...
Sarvesh's user avatar
  • 998
1 vote
Accepted

Rest reponse for empty field

You're not going to get an empty string unless you write some code to make it so. Salesforce does not store empty strings in the database, only null; when you query a record with a Text field that ...
David Reed's user avatar
  • 93.7k

Only top scored, non community-wiki answers of a minimum length are eligible