Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Populate subject person field in the description of HR task template

ArpitaVK
Tera Expert

I have a requirement to autopopulate the {subject person} in the description of HR task template. The subject person refers to another table. The description is like '<some text {subject person} some text>'. I have to only change the subject person dynamically for that particular HR task template. How to write BR for the same? 

1 ACCEPTED SOLUTION
4 REPLIES 4

@Sid_Takali Thank you for your quick response!

Not applicable

This works too: ${parent.ref_sn_hr_core_case.subject_person.name}

NityaB161013953
Mega Patron

Hi @ArpitaVK 

Create a Before Insert Business Rule on the HR Task (sn_hr_core_task) table.
In the script, check if the record uses your specific HR Task Template.
If yes, replace {subject person} in the description with the actual subject_person.getDisplayValue().

Example snippet:

if (current.template.name == 'Onboarding Checklist' && current.description) {
   var person = current.subject_person.getDisplayValue();
   current.description = current.description.replace(/\{subject person\}/gi, person);
}

Runs only for that template
Dynamically inserts the subject person’s name in the description before saving