Subject Person - Populate on short description

Vamsi Paidi
Kilo Expert

Hi,

We raise a HR Life Cycle Case from UI page we would like to get the Subject Person on the short description, 

1) On Submit

2) On Change

once the parent case subject person is change all the child cases & task will have also changed

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Vamsi,

For setting the short description you can use before insert BR on LE Case table

Script:

current.short_description = 'Subject Person is ' + current.subject_person.getDisplayValue();

For updating the child cases and tasks once parent case subject person is changed use the business rule

BR: After update on HR LE Case table

Condition: subject person changes

Script

var child = new GlideRecord('sn_hr_core_case');

child.addQuery('parent', current.sys_id);

child.query();

while(child.next()){

child.subject_person = current.subject_person;

child.update();

}

var childTask = new GlideRecord('sn_hr_core_task');

childTask.addQuery('parent', current.sys_id);

childTask.query();

while(childTask.next()){

childTask.subject_person = current.subject_person;

childTask.update();

}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Vamsi,

For setting the short description you can use before insert BR on LE Case table

Script:

current.short_description = 'Subject Person is ' + current.subject_person.getDisplayValue();

For updating the child cases and tasks once parent case subject person is changed use the business rule

BR: After update on HR LE Case table

Condition: subject person changes

Script

var child = new GlideRecord('sn_hr_core_case');

child.addQuery('parent', current.sys_id);

child.query();

while(child.next()){

child.subject_person = current.subject_person;

child.update();

}

var childTask = new GlideRecord('sn_hr_core_task');

childTask.addQuery('parent', current.sys_id);

childTask.query();

while(childTask.next()){

childTask.subject_person = current.subject_person;

childTask.update();

}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hey Ankur, 

I have a similar kind of issue. I want to update the short descriptions for all HR template(This HR template are then used for creating HR task) so that it shows name of opened for person (Task is opened for). Can you please help me regarding this

 

Thanks