Copy HR Parent Case fields to HR Child Case

Msteiner94
Tera Contributor

Hello,

I would like to have certain fields from an HR parent case to populate in the child case upon creation. For example, if the parent case has the watchlist populated, I'd like to configure something where the child case will pull the watchlist from the parent & populate it with the same names. What is the best way to do something like this?

1 ACCEPTED SOLUTION

Rob Sestito
Mega Sage

Hey @Msteiner94  - 

 

I created a script within a business rule that will work - but I only used your example using the Watch List. You will need to generate more like what I have here, to copy more.

 

Here is the BR:
I have When to Run as Before, and I have Insert and Update equal to True

 

Script:

 

 

(function executeRule(current, previous /*null when async*/ ) {

    var gr = new GlideRecord("sn_hr_core_case");
    gr.addQuery("parent", current.sys_id);
    gr.query();

    while (gr.next()) {
        gr.watch_list = current.watch_list;
        gr.update();
    }

})(current, previous);

 

Parent Case: (These are all OOTB Demo Data loaded so no need to block out personal info)

RobSestito_0-1714070990274.png

 

Child Case(s):

RobSestito_1-1714071051434.png

 

When I add users to the Watch List of the Parent Case and Save/Update the record:

RobSestito_2-1714071123002.png

 

Here are the Child Case(s):

RobSestito_3-1714071152140.png

 

Everyone I added in the Parent case have been added to the Child Case(s).

 

Give this a try, and if you need additional help please let us know!

 

Cheers,

-Rob

*p.s. Please don't forget to mark a reply as Helpful or Correct when appropriate*

View solution in original post

1 REPLY 1

Rob Sestito
Mega Sage

Hey @Msteiner94  - 

 

I created a script within a business rule that will work - but I only used your example using the Watch List. You will need to generate more like what I have here, to copy more.

 

Here is the BR:
I have When to Run as Before, and I have Insert and Update equal to True

 

Script:

 

 

(function executeRule(current, previous /*null when async*/ ) {

    var gr = new GlideRecord("sn_hr_core_case");
    gr.addQuery("parent", current.sys_id);
    gr.query();

    while (gr.next()) {
        gr.watch_list = current.watch_list;
        gr.update();
    }

})(current, previous);

 

Parent Case: (These are all OOTB Demo Data loaded so no need to block out personal info)

RobSestito_0-1714070990274.png

 

Child Case(s):

RobSestito_1-1714071051434.png

 

When I add users to the Watch List of the Parent Case and Save/Update the record:

RobSestito_2-1714071123002.png

 

Here are the Child Case(s):

RobSestito_3-1714071152140.png

 

Everyone I added in the Parent case have been added to the Child Case(s).

 

Give this a try, and if you need additional help please let us know!

 

Cheers,

-Rob

*p.s. Please don't forget to mark a reply as Helpful or Correct when appropriate*