To transfer existing HR Cases from one COE to another

vikramkhatr
Tera Contributor

Hello Experts,

Hope you all the doing well!

 

Under a requirement we have changed the topic details for few of the HR Services and now these are belonging to the expected COE however the existing HR Cases are still visible in existing COE.

 

I am looking to understand that, if there is any way to move those HR Cases to the updated COE.

 

Thanks in advance,

Vikram.

1 REPLY 1

Rob Sestito
Mega Sage

Hello @vikramkhatr - 

 

There are a couple of ways you should be able to do this. Through using a Fix Script or Load Data under System Import Sets.

I just ran a test using the Fix Script method in my PDI. And was able to change HR Cases under the following (this is all PDI Fake Data):
HR Service = Direct Deposit Setup

Topic Detail = Direct Deposit Setup
Topic Category = Payroll Administration

RobSestito_0-1726602059164.png

 

And move them to (before move):

HR Service = Request Background Check

Topic Detail = Background Check

Topic Category = Talent Management

RobSestito_1-1726602123454.png

 

Moved:

RobSestito_2-1726602204287.png

 

Here is the Fix Script Sample (You of course would need to adjust accordingly for your columns:

// Fix Script to move HR Cases from one HR Service/Topic Detail/Category to another
(function() {
    // GlideRecord to fetch HR cases with the old HR Service/Topic Detail/Category
    var grCases = new GlideRecord('sn_hr_core_case');
    grCases.addEncodedQuery("active=true^hr_service=9e28cde49f331200d9011977677fcf00^topic_detail=e442838d9f321200d9011977677fcf29^topic_category=8869360d9f321200d9011977677fcfd3");  // Old query hr cases
    grCases.query();
    
    gs.info('Found ' + grCases.getRowCount() + ' HR cases to update.');

    while (grCases.next()) {
        // Update HR Service, Topic Detail, and Topic Category fields to new values
        grCases.hr_service = '7ac3ece853322200d901a7e6a11c08ad';  // New HR Service Sys ID
        grCases.topic_detail = '0bead0a853322200d901a7e6a11c088a';  // New Topic Detail Sys ID
        grCases.topic_category = '8d4f46f353522200eb7c0a1806dc34c0';  // New Topic Category Sys ID

        grCases.update();  // Save the changes
    }
    
    gs.info('Updated ' + grCases.getRowCount() + ' HR cases to the new HR Service, Topic Detail, and Topic Category.');
})();

 

Basically, you are matching the cases you are referring to in a list view, copying the encoded query which gets inputted into your script, and then adding the sys_ids for where you want those cases to go.

 

If you'd like, give this a try - but in a PDI first to test it out. Keep in mind the short description will not change. If you need that as well, you would need to add it to your script into the while statement. Or, change manually afterwards.

 

Something else you might need to watch out for, if anything in the system gets triggered to send notifications or anything like that out. Since this is my PDI, nothing like that will happen for me.

 

Hope this helps - let us know if you need further assistance!

Cheers,

-Rob

**p.s. Please remember to mark replies as Helpful and/ or Correct when appropriate**