Skip to content

Adding Records to a Bulk Share

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8998
    AvatarChrisBoylan
    Participant

    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

    #8999
    AvatarChrisBoylan
    Participant

    That was for quick smaller lists. I later ran into tables that were missing 200k records. The script is not so good for that many. I created an import table and transform map that allowed me to populate the table a little quicker.

    #9001
    David LooDavid Loo
    Keymaster

    Not sure is you’ve seen this documentation, but you can get discrepancy check using table compare

    https://docs.perspectium.com/display/fluorineplus/Table+Compare

    And if checking between servicenow instances (InstanceSync), you can also generate a list of sys_id’s missing locally and automatically create a bulk share for it https://wiki.perspectium.com/doku.php?id=replicator_table_compare

    David

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.