Replicate group along with same sys_id in my all instances

smruti
Kilo Contributor

I have a requirement. Whenever a group is created in one of my servicenow instance, the group should auto replicate to other instances. My problem is to maintain sys_id of group in all instances if I use REST API to transfer group info. How can I achive it. Any help is highly appreciated.

Thanks,

Smruti

7 REPLIES 7

I want to complete this process automatically without manually export/import. I want to schedule it.

Thanks,

Smruti

smruti
Kilo Contributor

Using REST I may able to transfer group detail after creation from one instance to another. But I want to set sae sys_id during this integration. Kindly suggest.

Thanks,

Smruti

I was just looking at something in this area right now...

 

you can have an on insert BR and in the script use the following

var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://xxxxxxxtest.service-now.com/api/now/table/sys_user_group');
request.setHttpMethod('POST');

//Eg. UserName="admin", Password="admin" for this code sample.
var user = 'admin';
var password = 'admin';

request.setBasicAuth(user,password);
request.setRequestHeader("Accept","application/json");

var body = {"name":current.name,"sys_id":current.sys_id};
var bodyString = JSON.stringify(body);
request.setRequestBody(bodyString);

var response = request.execute();
gs.log(response.getBody());