Transferring groups from one instance to other

naga7777
Kilo Contributor

Hi All,

I created new update set and created a group. But when i go to the update set, group is not showing in the update log to commit. Can anyone please help me about transferring groups from one instance to other instance?

Regards,

NagaDinesh.

15 REPLIES 15

You are very welcome Nagesh.



If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you


randrews
Tera Guru

To tack onto what others mentioned..   I would reverse your process in the future...



when i create a group i have emails that are triggered on insert to send emails to the Service Desk and command center that a group as been added.. and an email to the manager to request to add members to the group... <we have that done via catalog to track license useage>>



Sooo i create all groups in PRODUCTION... then export the xml and import into other instances <dev etc> this lets the service desk know the groups are going to be getting tickets and get their process updated... and gives the manager time to request people be added in production so that the group can be maintained and will be ready to go on release night.


Shamma Negi
Kilo Sage
Kilo Sage

Hi Naga,



Either by using XML or you can click on add to update set.



Regards,


Shamma


Regards,Shamma Negi

Sarah F
Tera Contributor

I thought I'd post an update as the top answers are quite old now and there are better ways to do this - especially for multiple groups, so hopefully someone stumbling across this old question will find my post useful... 

N.B. Your update set should be created in the Global scope.

Option 1: Download the Add to Update Set plugin 

This adds an option to force transactional data to update sets:

find_real_file.png

The latest version also includes any 'related' data, so for groups, it will include the main sys_user_group record, but also add the dependant records from related tables (user memberships, roles, skills, and group types).

Warning: I've found that this bogs down at more than 25 groups, so if you've created a large number of new groups, Option 3 (force to update from a background script) may well be quicker and certainly less likely to crash your connection. This is because it exports all the related table records, which can also require time to remove unnecessary records e.g. group roles from the Update Set.

 


DIY

For the below options, ensure you capture all the data you need as group records exist across a few tables:

Main table

sys_user_group

Dependent tables

sys_user_grmember (group's members)

sys_user_group_type (group type)

sys_group_has_skill (group skills)

sys_group_has_role (group roles)

N.B. You may not want to export all of these tables - for instance, skills and roles are often inherited rather than granted directly.

Option 2: Export XML (as suggested)

If for some reason you can't install the plugin (it's really useful generally) and only have a few groups to do, you can export the XML from the group record:

find_real_file.png

 

You can then export go to the corresponding tables on the environment to import into, right click on a column header and 'import xml', ensuring you import to the sys_user_group table first.

Option 3: Force to update set from a background script

You can force to update set via a background script (rather than using the plugin from Option 1). The information is here courtesy of SN Guru.

Of course, instead of using .get, you can use a query with a while loop to add multiple groups' records from the tables you need e.g.

var um = new GlideUpdateManager2();

//Query for the record
var rec = new GlideRecord('sys_user_group');
   rec.addEncodedQuery('[YOURENCODEDQUREY]') //right click on a list filter to copy query
   rec.query();

while(rec.next(){
   //Push the record into the current update set  
   um.saveRecord(rec);
}

Versus the Plugin, this has the advantage of not adding records to your update set which aren't needed and it can be quicker for 20 groups or more

Dipu Joy
ServiceNow Employee
ServiceNow Employee
Update sets are intended for configuration purposes and not for data. The use of third-party tools to capture data in update sets from tables (which are not extended from sys_metadata OOB) can be detrimental, as the business rules (BRs) for data manipulation will not function with update sets. Since update sets are backend transactions, they do not trigger the data flow via BR (role/group inheritance), potentially leading to orphan records.

 

To transfer data and maintain relationships from related tables, please use Import XML. The relevant tables are listed in the Knowledge Base section How can I exclude and Preserve Users, Roles, and Groups?