HRJ Task Take Survey Widget

Koji Yanase
Tera Contributor

I can't find where HRJ Task Take Survey Widget is used. Can we make a survey as to-do task in Employee Service Center portal?

Thanks.

1 ACCEPTED SOLUTION

Willem
Giga Sage
Giga Sage

Hi Koji,

 

In short, you can by creating an Employee form. By creating a new HR Task of HR Task type "Collect Employee input" you can select the Employee form you want:

find_real_file.png

That will then be presented to the assigned to in the HRM To-do widget.

 

Technical longer explanation:

It is loaded in the to-do app via:

  • HRM To-do contains the "To-dos task Line Item"-widget
  • It will get the tasks that are to-do and their mapping to widget via the "todoPageUtils"-script include.
  • The "todoPageUtils"-script include contains the function "_getWidgetMappings" which gets the mapping from the "sn_hr_sp_todos_widget_mapping"-table.
  • In that table we find entries for HR Task:find_real_file.png
  • "HRM Task Activity"-widget calls "hr_TaskTicket"-script include. We are looking for the collect_information as that is the one containing a survey:
if (gr.hr_task_type == 'collect_Information'){
				task.employee_form = {};
				task.employee_form.id = gr.getValue('employee_form');
				task.employee_form.form_definition = gr.getElement('employee_form.form_definition');
				task.employee_form.survey_instance = gr.getValue('survey_instance');
				task.employee_form.table_Name = gr.getElement('employee_form.table')+'';
				task.employee_form.condition = gr.getElement('employee_form.condition')+'';
			}
  • The "HRM Task Activity"-widget in line 21 gets the widget for the specific task:
data.widget = $sp.getWidget(getTaskWidgetId('hrj-task-'), taskOptions);
				if(!data.widget.sys_id)
					data.widget = $sp.getWidget(getTaskWidgetId('hr-task-'), taskOptions);

 

View solution in original post

11 REPLIES 11

Willem
Giga Sage
Giga Sage

Hi Koji,

 

In short, you can by creating an Employee form. By creating a new HR Task of HR Task type "Collect Employee input" you can select the Employee form you want:

find_real_file.png

That will then be presented to the assigned to in the HRM To-do widget.

 

Technical longer explanation:

It is loaded in the to-do app via:

  • HRM To-do contains the "To-dos task Line Item"-widget
  • It will get the tasks that are to-do and their mapping to widget via the "todoPageUtils"-script include.
  • The "todoPageUtils"-script include contains the function "_getWidgetMappings" which gets the mapping from the "sn_hr_sp_todos_widget_mapping"-table.
  • In that table we find entries for HR Task:find_real_file.png
  • "HRM Task Activity"-widget calls "hr_TaskTicket"-script include. We are looking for the collect_information as that is the one containing a survey:
if (gr.hr_task_type == 'collect_Information'){
				task.employee_form = {};
				task.employee_form.id = gr.getValue('employee_form');
				task.employee_form.form_definition = gr.getElement('employee_form.form_definition');
				task.employee_form.survey_instance = gr.getValue('survey_instance');
				task.employee_form.table_Name = gr.getElement('employee_form.table')+'';
				task.employee_form.condition = gr.getElement('employee_form.condition')+'';
			}
  • The "HRM Task Activity"-widget in line 21 gets the widget for the specific task:
data.widget = $sp.getWidget(getTaskWidgetId('hrj-task-'), taskOptions);
				if(!data.widget.sys_id)
					data.widget = $sp.getWidget(getTaskWidgetId('hr-task-'), taskOptions);

 

Hi Willem,

Thank you for your help. Let me check this later.

Koji

Hi Koji,

You are welcome. Can you please mark the answer as Correct if it works for you.

Kind regards,

Willem

michaelj_sherid
ServiceNow Employee
ServiceNow Employee

@Koji Yanase There is a specific task type for the Survey specifically other than the Collect Employee Input. The difference between the "Take Survey" and "Collect Employee Input" task types is one is to Collect Employee Input then push the value back to another record (Parent LE Case or HR Profile, for example). The Take Survey task type is just for this, to take the survey (it does not map the input to other tables other than the answers to the survey). I hope this helps based on your use case.

Cheers,

Mike