HR case short description populating opened for name instead of subject person name

AshwiniSawant
Tera Contributor

Hello All,

I am working with a record procedure related to HR, which was created using the catalog builder. I have noticed that when an HR case is created, the short description populates the "requested for" or "opened for" name instead of the subject person's name. 

Could anyone provide suggestions on how to auto-populate the subject person's name?

Below is the record producer script for reference.

--------------------------------------------------------------------------------------------------------------------

new sn_hr_core.hr_ServicesUtil(current, gs).createCaseFromProducer(producer, cat_item.sys_id);
current.contact_type = 'service_catalog';
current.opened_by = gs.getUserID();
current.opened_for = gs.getUserID();
current.rich_description = producer.rich_description;
current.subject_person = producer.subject_person;

 

2 ACCEPTED SOLUTIONS

Sandeep Rajput
Tera Patron
Tera Patron

@AshwiniSawant Create an onBefore insert business rule on sn_hr_core_case table and set the short description with subject person name.

 

Hope this helps.

View solution in original post

@AshwiniSawant 

For HR cases, "Opened for" refers to the user who initially created or raised the case, while "Subject person" is the user who is the primary focus or concern of the case. The "opened for" person may be the same as the "subject person" but can also be someone acting on their behalf.

check this link for better explanation

The difference between Opened for and Subject person in HR service 

For your requirement you will have to update _setCommonFields method in script include hr_CaseUtils

AnkurBawiskar_0-1748527975350.png

OR Another easy way

You can use before insert business rule on HR Case table, something like this

current.short_description = current.hr_service.getDisplayValue() + ' ' + current.subject_person.getDisplayValue();

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

9 REPLIES 9

Already tried, getting requested by name in opened for

@AshwiniSawant 

For HR cases, "Opened for" refers to the user who initially created or raised the case, while "Subject person" is the user who is the primary focus or concern of the case. The "opened for" person may be the same as the "subject person" but can also be someone acting on their behalf.

check this link for better explanation

The difference between Opened for and Subject person in HR service 

For your requirement you will have to update _setCommonFields method in script include hr_CaseUtils

AnkurBawiskar_0-1748527975350.png

OR Another easy way

You can use before insert business rule on HR Case table, something like this

current.short_description = current.hr_service.getDisplayValue() + ' ' + current.subject_person.getDisplayValue();

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Ankur Bawiskar
Tera Patron
Tera Patron

@AshwiniSawant 

you are setting it with this line and it's not setting with that variable value?

current.subject_person = producer.subject_person;

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Thank you @Ankur Bawiskar  for your response.

 

the field value for the subject person is being set correctly, but it does not appear to be reflected in the short description.

 

AshwiniSawant_0-1748512688956.png

 

@AshwiniSawant 

the short description always populates with Opened for I believe

You can use before insert business rule to set it

If my response helped please mark it correct and close the thread so that it benefits future readers.

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