Bi-directional Incident Integration Between Two ServiceNow Instances Using OAuth

Mahalakshmi Rav
Tera Contributor

Hi all,

I have a requirement where I need to showcase bi-directional integration between two ServiceNow instances (let’s call them PDI A and PDI B) for the Incident table.

Whenever an incident is created, updated or deleted in one instance, it should automatically reflect in the other instance PDI A to PDI B, and vice versa so changes in PDI B should also sync back to PDI A.

I want to use OAuth 2.0 for authentication instead of basic auth and that's the main requirement here.

Steps which i executed:
1. So far, I have created an OAuth profile in Instance B (as an OAuth client) and created one integration user with the necessary roles and web service access is enabled.

MahalakshmiRav_0-1778705510736.png

MahalakshmiRav_1-1778705628125.png

 

2. In Instance A, I created an OAuth provider profile using the same client ID and secret, set up a REST message and successfully generated an OAuth token. I then created a POST method, but when I try to test 'Create INC http', it’s throwing an error.

MahalakshmiRav_3-1778705898389.pngMahalakshmiRav_4-1778705992449.png

 

MahalakshmiRav_6-1778706102000.pngMahalakshmiRav_7-1778706120524.png

 

I’m not sure what went wrong, can someone please advise?

 

Thanks!

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Mahalakshmi Rav 

Refer below link for step by step instructions

ServiceNow to ServiceNow Integration using REST API and PUSH and PUT methods with Business Rule 

You can also explore on Ebonding Spoke with less scripting

ServiceNow eBonding spoke 

Refer the below link which has the approach with example shared by me.

Integration hub ebonding spoke 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

11 REPLIES 11

Hello @adilalee200 , You only need to provide the rest_service and itil user roles and you can remove the rest. For the POST HTTP request, make sure that the authentication option is set to "Inherit from Parent."

Instance B appilcation registry and user roles

adilalee200_0-1780588053159.png

adilalee200_1-1780588122675.png

Instances A 

Appilcation Registry

adilalee200_2-1780588307595.png

Rest Message 

adilalee200_3-1780588573254.png

A INSTANCE Endpoint OR B INSTANCE URL

adilalee200_5-1780588682169.png

 

HTTP Method

adilalee200_6-1780588818120.pngadilalee200_7-1780588851060.png

Script Inlcude and Scheduled JOB

adilalee200_8-1780588980495.png

adilalee200_9-1780589071449.png

BR

After InSert

adilalee200_10-1780589216714.png

 

I haven't achieved mine using the Scheduled Job and Script Include. May I know what error you are facing?

Ankur Bawiskar
Tera Patron

@Mahalakshmi Rav 

Refer below link for step by step instructions

ServiceNow to ServiceNow Integration using REST API and PUSH and PUT methods with Business Rule 

You can also explore on Ebonding Spoke with less scripting

ServiceNow eBonding spoke 

Refer the below link which has the approach with example shared by me.

Integration hub ebonding spoke 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader