Seamless Salesforce-to-Salesforce Integration Using OmniStudio Integration Procedures

In today's interconnected digital landscape, enterprises often operate multiple Salesforce orgs across departments, regions, or subsidiaries. Enabling smooth, real-time integration between these orgs can unlock major efficiencies. Enter OmniStudio's Integration Procedures — a powerful, low-code tool designed to streamline and optimize complex integrations. In this blog post, we explore how Integration Procedures can be used to connect two Salesforce orgs with a real-life use case.

The Use Case: Syncing Cases Between Two Orgs

Let’s say you are a Salesforce partner (Org A) providing managed services to a client (Org B). The client logs support cases in their org, and your internal support team needs those cases available in your own Salesforce org for further action. Instead of manually exporting and importing data, you want a real-time, automated sync of case records.

The Solution:

  • Org A: Source Org (Partner Org)
  • Org B: Target Org (Client Org)
  • Communication: Via REST API (secure using Named Credentials + Apex)

In Org B (Client Org):

  • Create Connected Org:

    • Go to Org B → Setup → App Manager → New Connected App
    • Fill these:

      • Name: APIAccessApp
      • Enable OAuth Settings

        • Callback URL:
          https://login.salesforce.com/services/oauth2/callback
        • Selected OAuth Scopes:

          • Access and manage your data (api)
          • Perform requests on your behalf (refresh_token, offline_access)
        • Save and then click "Continue".
        • After some time (2–10 min), go to the Connected App → Note down

          • Consumer Key
          • Consumer Secret
  • Create apex class (REST API):
                   
    @RestResource(urlMapping='/ReceiveCase')
    global with sharing class CaseReceiverController {
    
        @HttpPost
        global static String createCase() {
            RestRequest req = RestContext.request;
            String body = req.requestBody != null ? req.requestBody.toString() : '';
    
            System.debug('📥 Incoming Request Body: ' + body);
    
            if (String.isBlank(body)) {
                return '❌ Error: Empty request body.';
            }
    
            try { Map data = (Map) JSON.deserializeUntyped(body);
    
                Case c = new Case();
                c.Subject = (String)data.get('Subject');
                c.Description = 'Created from Org A via API';
                c.Priority = (String)data.get('Priority');
                c.Status = (String)data.get('Status');
                c.Origin = (String)data.get('Origin');
    
                insert c;
    
                return '✅ Case created with ID: ' + c.Id;
    
            } catch (Exception ex) {
                System.debug('❗ Error while processing request: ' + ex.getMessage());
                return '❌ Error: ' + ex.getMessage();
            }
        }
    }
    
    
                   
                

In Org A (Your Org):

  • Create Named Credentials:

    • Go to Org A → Setup → Named Credentials → New Named Credential
    • Fill these:

      Org Credentials

    • Click on save.
  • Create Auth. Provider if not created:

    • Go to Setup → Auth. Providers → New
    • Provider Type: Salesforce
    • Consumer Key / Secret: Paste from Connected App
    • Authorize Endpoint URL:
      https://login.salesforce.com/services/oauth2/authorize
    • Token Endpoint URL:
      https://login.salesforce.com/services/oauth2/token
    • Save and Copy Callback URL, paste it into Connected App.
    • After setting up, test Named Credential → "Authenticate"
    • Create OmniScript (Get case data from user):

      • Go To App launcher -> Omnistudio -> Omniscript
      • Click on “new”.
      • Enter Name, Type, SubType, Author and Click on “save”.
      • Add step and inside that Add all the required fields of case object According to the Requirement.
      • Add DataRaptor post Action for record Creation.

        • Go to Omnistudio -> DataRaptor -> click on “New”.
        • Fill name select “Post” DataRaptor -> save.
        • In the Object tab select “case” as Object.
        • Map the Fields.

          Map the Fields

          Case Fields

      • Add Integration procedure for callout.

        • Go to OmniStudio -> Integration Procedure -> “New”.
        • Enter Name, Type, SubType and Click on “save”.
        • Add Conditional Block. Put condition

          Add Conditional Block

        • Inside Conditional Block Add “HTTP Action”.
        • Enter the Fields as given below:

          Fields Seamless

        • Add JSON inside Send JSON Path
                         
                            {
           "Subject": "{CaseSubject}",
            "Description": "{CaseDescription}",
            "Priority": "{CasePriority}",
            "Status": "{CaseStatus}"
          }
          
                        
                      

    Note :- OmniStudio will auto-replace these variables from the context or inputs.

    • Activate the Integration Procedure
    • Activate omniScript and add the omniscript in page layout.
    • We are good to go…

    Example JSON Payload Sent from Org A

                   
     {
      "caseNumber": "000123",
      "subject": "Unable to log in",
      "priority": "High",
      "status": "New",
      "origin": "Client Org",
      "description": "User reports login failure after password reset"
    }
    
    

    Why Use Integration Procedures?

    • Low-code orchestration of multiple steps (no Apex required)
    • Efficient API usage with bulk-friendly architecture
    • Built-in error handling and version control
    • Secure via Named Credentials or Token Authentication

    Pro Tips

    • Use Named Credentials to authenticate the connection securely.
    • Add DataRaptor Extracts to enrich or validate incoming data.
    • Leverage Conditional Steps in the Integration Procedure to route data differently based on business logic.

    Conclusion

    OmniStudio Integration Procedures make Salesforce-to-Salesforce integrations smooth, scalable, and easy to maintain. Whether you're syncing cases, accounts, or custom data structures, this feature allows you to build robust integrations without writing custom code. If your enterprise works with multiple Salesforce orgs, it's time to explore the power of Integration Procedures.

    Got questions? Feel free to drop an email to support@astreait.com