Population HR Case -opened for User name to Short description of HR Task

Bhavani3
Tera Contributor

I have a requirement include Opened for user name in Hr Task form short description field 

i created business rule but not working as expected .can somebody help me on this to sort out ?

Advance Thanks

 

Here below short description field  have to append Opened for user name

Bhavani3_0-1721662536746.png

 

6 REPLIES 6

Hi Sandeep 

 

I need in HR Task short description field,i created BR for table HR Task and condtion-Before-insert,update i have givend

Below the code added

var hrCase = current.parent;
 
         if (hrCase) {
             // Fetch the HR Case record
             var hrCaseRecord = new GlideRecord('sn_hr_core_case');
             if (hrCaseRecord.get(hrCase)) {
                 // Get the "opened for" user's name
                 var userName = hrCaseRecord.opened_for.getDisplayValue();
                 
                 // Combine HR Case short description and user name into HR Task short description
                 current.short_description = hrCaseRecord.short_description + ' - Opened for ' + userName;

                 }
}
 
above you mentioned code also tried but not working

JulianLemcke
Kilo Sage

Could you not script it within the Template? I've seen that you are using a template. You can script in the templates with "Javascript: {Your server-side script}"