
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 04-18-2021 09:55 AM
One of the HR Task Type in ServiceNow is called “Collect Employee Info” and can be really useful when the HR Agent needs to collect data from the employee:
As this is a separated record than the HR Case / Task it can be quite inconvenient to look for the responses by the Agent once is completed.
The suggestion is to have instead a related list on the HR Case that show all the child HR Task Employee Forms completed by the employee.
Clicking on any of the Employee Forms in the related list the agent can see the employee responses:
- First click on the Assessment Number
- Second click on the View User’s responses (for this demo I am using a simple Employee form asking the employee if they like ice cream):
In order to make it work on your instance as well you need to create a new Relationship [sys_relationship] (see attachments)
- Name: Employee Form
- Applies to table: HR Case [sn_hr_core_case]
- Queries from table: Assessment Instance []
- Query with:
(function refineQuery(current, parent) {
var hRCase = parent;
var assessmentInstance = current;
var hrCaseId = hRCase.sys_id;
var grHRTasks = new GlideRecord("sn_hr_core_task");
grHRTasks.addQuery("parent", hrCaseId).addOrCondition("parent.parent", hrCaseId).addOrCondition("parent.parent.parent", hrCaseId);
grHRTasks.addQuery("hr_task_type", "collect_Information");
grHRTasks.addNotNullQuery("survey_instance");
grHRTasks.query();
if (!grHRTasks.hasNext())
current.addQuery("sys_id", "NULL");
while (grHRTasks.next()){
current.addQuery("sys_id", grHRTasks.survey_instance);
}
})(current, parent);
Now on the HR Case go to Configure Related List and add Employee Form:
- 1,892 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you. Were you successful in having this mapped to fields yet in Quebec? Another query is for mapping it to the HR task related list, we have to create a new relationship like this?