Salesforce Interview Questions &
Answers
Integration
Q: How do you create JSON data in Apex?
A: You can use the JSON.serialize() method.
Example:
Map<String, Object> jsonMap = new Map<String, Object>{'Name' => 'Test', 'Industry' =>
'IT'};
String jsonBody = JSON.serialize(jsonMap);
Q: How do you send JSON data through a callout in Apex?
A: Use HttpRequest and set the body as JSON.
Example:
HttpRequest req = new HttpRequest();
req.setEndpoint('https://example.com/api');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');
req.setBody(JSON.serialize(yourMap));
Http http = new Http();
HttpResponse res = http.send(req);
Q: How do you give object-level access (Account, Contact, etc.) in a connected
app?
A: Through OAuth Scopes and Profiles/Permission Sets. Assign appropriate scopes (like api,
refresh_token) and grant object access via permission sets assigned to the user of the
connected app.
Q: What info is needed to make a callout from a third-party to Salesforce?
A: Client ID, Client Secret, Username, Password (+ security token if IP not whitelisted), and
the Token endpoint to get the access token.
Q: Does REST support XML format? How to do it?
A: Yes, Salesforce REST API supports XML. Use Accept: application/xml in the headers and
send the body in XML format.
Q: What are Named Credentials? How to call them in Apex?
A: Named Credentials store endpoint URLs and authentication. In Apex:
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:MyNamedCredential/someEndpoint');
Q: Before Named Credentials, how was data stored for external endpoints?
A: Using Custom Settings, Custom Metadata, or hardcoding endpoint URLs and tokens in the
Apex code (which is not secure).
Q: How to create an Account without using web services from a third-party
system?
A: You can use Salesforce APIs (REST/SOAP) from the third-party system to insert Account
records directly via HTTP POST to /services/data/vXX.X/sobjects/Account.
Q: What is Single Sign-On (SSO)?
A: SSO allows users to log in once and access multiple systems. Salesforce supports SSO
using SAML, OAuth, and OpenID Connect. It enhances security and improves user
experience.