I recently had to share a large number of records to a database due to record deletion on the database side. ( long bad story about clones and QA data going to Production). I was able to pull a list of Sys_ids from the database and using the Export Set feature in ServiceNow, I was able to get a list of Sys_ids there too. A quick compare showed what Sys_ids needed to be added to a bulk share to push the data back to the database. I set a bulk share up and then in the Filter and Enrichment section, I checked the Share only Sys IDs listed check box. Rather than put the IDs in one by one, I used this background script to add them to the correct table:
var share='<bulk share sys_id>';
var array = [
<insert comma seperated list of sys_ids here
];
var gr = new GlideRecord('u_psp_bulk_share_sys_id');
for(var i = 0; i < array.length; i++){
gs.print(array[i]);
gr.initialize();
gr.u_bulk_share = share;
gr.u_record_sys_id = array[i];
gr.insert();
}
You can remove the gs.print if you don’t want to see that. You do need to have the bulk share setup first and grab the sys_id of teh bulk share in the first variable of the script