Case to Incident bidirectional integration between two servicenow Instances

User2886
Kilo Explorer

Hi all,

 

We have a requirement to integrate two servicenow instances Bidirectional .

 

Instance1 : When case created, corresponding incident needs to be created in Instance 2, and when some changes like assigment group or state in INC, same has to flow back to Instance 1 and update case.

 

Using scripted REST APIS,

 

I am working in instance 1 where case created .

 

Can some one help me with details like how to start.

 

I have recieved Instance URL, OAuth token url, Client ID & Secret.

 

thanks

 

1 REPLY 1

Yogesh11bhatt
Kilo Guru

Hi @User2886 ,

 

Since you've already received the Instance URL, OAuth Token URL, Client ID, and Client Secret, you're in a good position to start building the integration.

For a bidirectional integration between two ServiceNow instances using Scripted REST APIs, I would recommend the following approach:

High-Level Design

Instance 1 (Case Source)

  • Case created → Create Incident in Instance 2.

  • Store the Incident Number or Sys ID returned from Instance 2 on the Case record.

Instance 2 (Incident Target)

  • Incident updated (State, Assignment Group, etc.) → Call Instance 1 API.

  • Instance 1 updates the corresponding Case using the stored correlation value.

Step 1: Configure OAuth Connection

Since you have:

  • Instance URL

  • OAuth Token URL

  • Client ID

  • Client Secret

Create an OAuth profile in Instance 1 and test token generation first.

You can validate connectivity using a simple REST Message before building business logic.

Step 2: Create a Scripted REST API in Instance 2

Create a Scripted REST API that accepts Case information from Instance 1.

Example payload:

{
  "case_number": "CASE0010001",
  "short_description": "Email issue",
  "description": "User unable to send emails",
  "priority": "2"
}

The API should:

  • Create the Incident.

  • Return Incident Number and Sys ID.

Example response:

{
  "incident_number": "INC0012345",
  "incident_sys_id": "xxxxxxxxxxxxxxxx"
}

Step 3: Trigger from Instance 1

Create either:

  • Business Rule (After Insert)

  • Flow Designer Flow

  • Event + Script Action (recommended for scalability)

When a Case is created:

  1. Generate OAuth token.

  2. Call Instance 2 Scripted REST API.

  3. Store returned Incident Sys ID and Number on the Case record.

I usually recommend storing:

  • Correlation ID

  • Correlation Display

for easier synchronization.

Step 4: Send Updates Back to Instance 1

In Instance 2:

Create an After Update Business Rule (or Flow) on Incident.

When fields such as:

  • State

  • Assignment Group

  • Assigned To

  • Work Notes

  • Comments

change, call a Scripted REST API hosted in Instance 1.

Example payload:

{
  "incident_sys_id": "xxxxxxxx",
  "incident_number": "INC0012345",
  "state": "In Progress",
  "assignment_group": "Network Team"
}

Instance 1 receives the payload and updates the corresponding Case.

Step 5: Prevent Integration Loops

This is the most important part of bidirectional integrations.

Without protection:

Instance 1 updates Case
→ Instance 2 updates Incident
→ Instance 1 updates Case
→ Infinite loop

Recommended approaches:

  • Integration flag field

  • Source system field

  • Correlation ID checks

  • Skip Business Rules when update originates from integration

Recommended Architecture

Instead of direct Business Rule → REST Call, I usually recommend:

Case Created
    ↓
Event Queue
    ↓
Script Action
    ↓
REST Message
    ↓
Instance 2

This keeps the user transaction fast and avoids delays if the target instance is unavailable.

Suggested First Milestone

Before building the full bidirectional sync:

  1. Generate OAuth token successfully.

  2. Create a REST Message in Instance 1.

  3. Call a simple Scripted REST API in Instance 2.

  4. Create a test Incident.

  5. Capture and store the Incident Sys ID.

Once that works, implement the reverse update flow.

Hope this helps you get started!

Please mark this answer as Helpful if it resolves your question. 🙂

Thanks,
Yogesh Bhatt