๐ Real-Time Salesforce to Oracle REST API Integration – Beginner Guide with JSON and Logging
Salesforce to Oracle REST API Integration
๐ Overview
In this blog, we’ll cover a real-time outbound REST API integration from Salesforce to Oracle. When a user clicks a button on a Customer__c record, Salesforce will:
-
Send the customer data + related records (Orders & Addresses) to Oracle
-
Show success or failure messages
-
Log the integration request and response for tracking
๐ Use Case
“Send Customer data to Oracle when status = Completed and user clicks Send Data.”
-
If the call is successful: ✅ show a success message
-
If the call fails: ❌ show a failure message
-
In all cases: ๐งพ store the request and response in a log
| Visualizing Salesforce-Oracle Integration |
๐ฆ Type of Integration:
Salesforce is the client, and Oracle is the server.
๐งฑ Step-by-Step Implementation:
Step 1: Get API Details from Oracle Team
Before building anything, ask the Oracle team to share:
Step 2: Create Custom Objects in Salesforce
-
Customer (Parent) - Standard Object
-
Order (Child of Customer) - Standard Object
-
Address__c (Child of Customer) - Text Fields - Street , City , State, Zip Code, Country and Customer lookup field
-
Integration_Log__c – to store request/response - Customer lookup to Customer, Request Body and Response Body is Long Text Area , Status Code is Text field, Timestamp is DataTime field , Success? is checkbox field and Error Message is Long Text Area.
Step 3: Setup Named Credential
Purpose: Store Oracle’s API endpoint securely.
Setup → Named Credentials → New
Step 4: Create Apex Class for Integration
This class will:
-
Fetch customer and related records
-
Convert data to JSON
-
Make the callout
-
Handle response
-
Log everything
Step 5: LWC Button (Optional Frontend Trigger)
You can create a Lightning Web Component with a "Send to Oracle" button to call this Apex method and show toast messages.
1. sendToOracleAction.html
2. sendToOracleAction.js
3. sendToOracleAction.js-meta.xml
Next ๐ช Step-by-Step: Add Custom Button as Lightning Action
Go to Object Manager
-
Go to Setup → Search for Object Manager
-
Select your object → e.g.
Customer
Create Lightning Action
-
Go to Buttons, Links, and Actions
-
Click New Action
-
Set values:
-
Action Type:
Lightning Component -
Lightning Component:
c:sendToOracleAction -
Label:
Send to Oracle -
Name: (auto-filled)
-
-
Click Save
Add Action to Page Layout
-
Still inside the Customer object, go to Page Layouts
-
Choose your layout (e.g.,
Customer Layout) -
Scroll to Mobile & Lightning Actions
-
Drag "Send to Oracle" action from top palette into that section
-
Save the layout
Try it Out!
-
Go to any Customer__c record
-
At the top-right, you'll see the Send to Oracle button
-
Click it:
-
Modal pops up
-
Data is sent to Oracle immediately (via
connectedCallback) -
Success/failure toast is shown
-
Modal closes automatically
This step ensures your "Send to Oracle" button actually:
-
Sends data to Oracle
-
Shows success or failure
-
Logs the response in Salesforce
๐ช 1. Prepare Test Data
-
Go to App Launcher → search for and open Customer
-
Create a new Customer or open an existing one
-
Set Status__c = "Completed" (or your equivalent status field)
๐ This should match the logic in your Apex controller that checks status before sending.
๐ช 2. Click the "Send to Oracle" Button
-
Open the Customer__c record
-
In the top-right action bar, click Send to Oracle
-
A modal opens
-
Behind the scenes:
-
LWC sends JSON data to Oracle via REST API
-
Shows success or error toast
-
Modal closes automatically
๐ช 3. Check Integration Logs in Salesforce
๐ง If you created a custom object like Integration_Log__c:
-
Go to App Launcher → open Integration Logs tab
-
Look for the most recent log entry
-
You’ll see fields like:
-
Customer__c (lookup to the customer)
-
Status__c (
SuccessorFailed) -
Request_Body__c (sent JSON)
-
Response_Body__c (Oracle’s reply)
-
Timestamp
-
๐ช 4. Confirm with Oracle Team (Optional)
If Oracle is a real external system and you're working with their devs:
-
Share the Customer ID or Order ID
-
Ask Oracle team:
-
Did they receive the payload?
-
Was it processed correctly?
-
Was there an error?
-
-
They might also provide a response like:
Step 7: JSON Explained
This is how the final JSON might look:
๐ Summary Table
Thank you for exploring Salesforce to Oracle REST API Integration!
I hope this guide provided valuable insights into real-time outbound API connections.
For a better experience, I recommend viewing this blog on a desktop, as the mobile version is still being optimized.
Your feedback and thoughts mean a lot—please share your comments below.
Happy integrating!
Blog by Yeshwanth
Comments