SALESFORCE ENTHUSIASTS
NUMBER OF WAYS
TO MAKE API
CALLS IN
SALESFORCE
USING INTEGRATION PROCEDURES (IP) 02
integration Procedures are declarative tools in Salesforce that allow you to create server-side processes
without writing Apex code. They are best suited for complex, multi-step operations and are often used in
Omnistudio applications.
Advantages of Integration Procedures:
Reduces complexity by avoiding custom Apex code
Supports branching and conditional logic
Ideal for server-side processing
Salesforce Enthusiasts
USING JAVASCRIPT (FETCH API & ASYNC/AWAIT) 03
JavaScript can be used to call external APIs directly from an LWC component using native browser
methods. However, due to Salesforce’s Content Security Policy (CSP), direct API calls often require
remote site settings or named credentials.
Explanation of Fetch API with Async/Await:
fetch() initiates the HTTP request and returns a Promise.
await pauses the function execution until the promise
resolves or rejects.
[Link]() parses the JSON response body.
Error handling is straightforward using try/catch blocks.
Advantages of JavaScript Fetch:
Asynchronous handling with promises or async/await
Direct and simple for lightweight operations
No need for server-side processing
Salesforce Enthusiasts
USING APEX 03
Apex provides server-side capabilities to make API calls in Salesforce. You can create an Apex
class with a callout method and expose it via AuraEnabled methods for LWC.
Advantages of Apex:
Greater control over callouts
Can handle complex logic and transformations
Supports error handling and retries
Salesforce Enthusiasts