Checklist for HR task

gowdash
Mega Guru

Dear Experts,

I have a scenario to implement an exit clearance checklist in ServiceNow HRSD. Employees and other teams like IT, Security, Employee Manager should complete the exit clearance checklist. The idea is to create an HR Case, create parallel HR Tasks [automatically using the Service Activity] and assign it to the relevant stakeholders to complete, Close the case automatically once all the tasks are completed. There are a few checklist items that each stakeholder needs to perform, like, "Received the locker keys", "Received the laptop" etc. I am looking for an option to configure the checklist for HR Tasks so that it is prepopulated [From the template] when an HR Task is created.

Please advise on how to implement this or is there a better way of doing this?

Best,

Gowdash

1 ACCEPTED SOLUTION

Susan Britt
Mega Sage
Mega Sage
This is OOB functionality, adding checklist to the HR Task Template. When you create your service activities, be sure it references the correct HR Task Template. The checklist will appear on the form for the teams.

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@gowdash 

You should be able to add checklist for HR Task using this link

Follow the steps

AUTO GENERATE CHECKLISTS

Regards
Ankur

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

@gowdash 

refer this link as well

Checklists in HR cases and tasks

Regards
Ankur

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

@gowdash 

Ensure you are in HR Core scope

Steps

1) visit checklist_template.LIST table

2) create new HR Task checklist with the questions you require

3) Then create UI formatter for HR Task table

4) Configure form layout for HR Task and add the checklist on the form

5) Then create Before insert BR on HR Task with proper condition and it would attach the checklist to HR Task record

Template for JSON

{
  "name": "HRTaskChecklist",
  "items": [
    {
      "name": "Please fill email",
      "order": "1"
    },
    {
      "name": "Please fill phone",
      "order": "2"
    }
  ]
}

find_real_file.png

find_real_file.png

find_real_file.png

BR Script:

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var task = current.sys_id;
	var table = current.getTableName();
	var template = getTemplate('HR Task Checklist'); // name of the Checklist
	generateChecklist(template, table, task);
	
})(current, previous);

function getTemplate(name){
	var grTemplate = new GlideRecord('checklist_template');
	grTemplate.get('name',name);
	return grTemplate.template;
}

function generateChecklist(template,table,task) {
	var json = new global.JSON();
	var itemJSON = json.decode(template);
	var name = itemJSON['name'];
	var items = itemJSON['items'];
	var owner = itemJSON['owner'];
	var checklistId = '';

	var grList = new GlideRecord('checklist');
	grList.addQuery('document', task + '');
	grList.addQuery('table', table);
	grList.query();
	if (!grList.next()) {
		grList.document = task + '';
		grList.name = name;
		grList.owner = owner;
		grList.table = table;
		checklistId = grList.insert();

		for (var i = 0; i < items.length; i++) {
			var grItem = new GlideRecord('checklist_item');
			grItem.checklist = checklistId;
			grItem.complete = false;
			grItem.name = items[i]['name'];
			grItem.order = items[i]['order'];
			grItem.insert();
		}
	}
}

Regards
Ankur

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

Susan Britt
Mega Sage
Mega Sage
This is OOB functionality, adding checklist to the HR Task Template. When you create your service activities, be sure it references the correct HR Task Template. The checklist will appear on the form for the teams.