Restoring a deleted role and related tables
Deleting an important role can have a big impact on an instance. In this case, restoring the instance from backup is not the solution. Follow the steps below to restore a deleted role and its related tables, therefore helping regain the previous order.
Some manual fixes may be needed after restoring the deleted records but the restoration of specific tables will help get users, groups, applications, and modules working as expected again. The following steps use the itil role as an example of the deleted role.
Step 1: Locate the deleted record and restore it.
To located and restore the deleted record:
- Navigate to System Definition > Deleted Records.
- Filter the list using Tablename | is | sys_user_role. Alternatively, add the following extension to the instance URL: /sys_audit_delete_list.do?sysparm_query=GOTOtablename%3dsys_user_role.
- If the record is not available to restore, you can export and import the role in XML format from another instance. For additional information, refer to Export List Data.
Note: The sys_id of the role should match with the tables that are being copied from the other instance.
Step 2: Export related tables from a sub-production instance where the role relationships are intact.
- Right-click the list header and select Export > XML to pull specific lists of the records that are needed.
- Export the data from the most recent copy of the affected instance. The list below indicates the main tables that should be copied over, note that we are filtering the lists to only include the records that are related to the role that is being restored.
( user roles table where users had the itil role )
[ e.g. /sys_user_has_role_list.do?sysparm_query=role%3Daf9af44ae0400100b22b979b3b4ec7ac&sysparm_view= ]
( module records that had the itil role )
[ e.g. /sys_app_module_list.do?sysparm_query=roles%3Ditil&sysparm_view= ]
( application records that had the itil role )
[ e.g. /sys_app_application_list.do?sysparm_query=active%3Dtrue%5Edevice_type!%3Dmobile%5Eroles%3Ditil&sysparm_view= ]
( group roles table that had the itil role )
[ e.g. /sys_group_has_role_list.do?sysparm_query=role%3Daf9af44ae0400100b22b979b3b4ec7ac&sysparm_view= ]
( roles that had the itil role )
[ e.g. /sys_user_role_contains_list.do?sysparm_query=contains%3Daf9af44ae0400100b22b979b3b4ec7ac&sysparm_view= ]
Step 3: Import related tables to the affected instance.
- Navigate to any list on the target instance.
- Right-click the column header in the list and select Import > XML.
Step 4: Review the results and manually fix any remaining items.