Skip to main content

Apex Callouts

Explore practical guides and implementation patterns for this topic.

Posts

Topic Salesforce Security
Salesforce Security & Access

Salesforce Remote Site Settings vs. CSP Trusted Sites Explained

💬 In plain words: Think of these as two completely separate security allow-lists that guard different doors. Remote Site Settings give your Salesforce backend server (Apex or Flow HTTP Callout) permission to call an external URL. CSP Trusted Sites (now grouped under Trusted URLs in Salesforce Setup) give the user's web browser (LWC or Aura) permission to fetch data, images, or scripts from an external URL. If an Apex callout fails, check Remote Site Settings or Named Credentials . If a browser request fails inside an LWC, check your CSP Trusted Sites! 📌 Real-Life Example: Imagine you are building a live weather dashboard on an Account page. First, your Apex class tries to fetch weather data from https://api.weather.com , and Salesforce immediately throws a System.CalloutException: Unauthorized endpoint error. Why? Because the Salesforce server blocked the call. The fix is adding a Remote Site Setting (or better yet, a Named Credential). Later tha...
Read article
Lightning Web Components

How to Track IP Geolocation in Salesforce using LWC and Apex Callouts

Tracking user locations based on IP addresses is a frequent requirement for security auditing, fraud detection, and creating localized customer experiences inside Salesforce. While legacy systems relied heavily on Visualforce, modern Salesforce architecture dictates using Lightning Web Components (LWC) backed by an Apex REST callout to fetch and display this geographic data securely. In plain words: An LWC captures the IP address input by the user and passes it to an Apex class. The Apex class sends an HTTP request to an external geolocation API, receives a JSON package containing location details (like city, country, and time zone), parses it, and sends it back to the LWC to be displayed on the screen.
Read article
Topic Integration & APIs
Salesforce Integration & APIs

Salesforce Inbound vs Outbound Integration Patterns: Architecture & Best Practices

In plain words: Think of Inbound Integration as receiving mail into Salesforce (external systems pushing data or Salesforce pulling external data), while Outbound Integration is sending mail out (Salesforce notifying external ERPs, payment gateways, or databases when something happens). Connecting Salesforce to external enterprise systems requires deciding the direction of data flow and the timing of the exchange. Depending on your business process, integrations operate either as inbound requests entering Salesforce or outbound events dispatched to external platforms.
Read article