How do I Automatically Generate a Checklist on Task or Incident Submission?

Jordan Humphre1
Giga Contributor

Hello,

 

I have an extended task table called "Branch Visits" and a form within it that is used for managing a technician's routine branch visit.

What I am looking to accomplish is to automatically generate a pre-defined checklist that appears on the form itself upon submission of the task. In addition, I want those checked off items to appear if I attempt to print the form or e-mail the results to the branch manager for each item checked.

I read that someone had a similar question a while back (about 2 years ago) but was hoping that maybe some better ways to do this may exist.

 

Any ideas?

6 REPLIES 6

Mark Roethof
Tera Patron
Tera Patron

Hello Jordan,

What do you exactly mean by a checklist? Something like this perhaps?

find_real_file.png

You could enable this by adding:
- UI Macro
- UI Formatter
- Adding the Formatter to your form lay-out

UI Macro example:

Name "inline_checklist_macro"

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<g2:evaluate>
		var isBrowserSupported = (GlideVTBCompatibility.getCompatibility() != 'block');
		var isNewUI = gs.getProperty('glide.ui.doctype', 'false') == 'true';
		var isNewRecord = true;
		if (isBrowserSupported $[AMP]$[AMP] isNewUI) {
			var sysID = current.getUniqueValue();
			var tableName = current.getTableName();
			isNewRecord = current.isNewRecord();
			
			// get the checklist ID for this record
			var checklistID = null;
			var checklist = new GlideRecord("checklist");
			checklist.addQuery("document", sysID);
			checklist.addQuery("table", tableName);
			checklist.query();
			if (checklist.next()) {
				checklistID = checklist.getUniqueValue();
			}
		}
	</g2:evaluate>
	<body>
		<j2:if test="$[!isNewRecord]">
			<g:macro_invoke macro="checklist_template" readonly="false" record="$[sysID]" table="$[tableName]" checklistid="$[checklistID]"/>
		</j2:if>
	</body>
</j:jelly>

UI Formatter:

Name "Checklist"
Formatter "inline_checklist_macro.xml"
Table "your table, ?u_branch_visits?, or task"
Type "Formatter"

Form lay-out:

Add the "Checklist" formatter

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

I have tried this.
and It's working perfect.

Brian Bouchard
Mega Sage

If you're talking about a checklist of tasks, we have something similar in place based on a UI action, buy you could apply the same logic to a business rule on insert..

1) Create a template for each item in your checklist against the Planned task table, with a specific naming convention like "Branch Visit PT *"

2) When a row is inserted into the Branch visits table run a script that

      queries the sys_template table for all templates with a name starting with "Branch Visit PT"

      for each template found, create a planned task, applying the template.

 

3) Add a related list to the form for Planned task -> Parent

It's not super elegant, but its very flexible and allows you to easily maintain the planned tasks for various "flavors" of tasks.

 

 

Jordan Humphre1
Giga Contributor

Thanks guys. I guess what I'm getting at though is that I do have the Checklist formatter on the form. I just need a business rule script that essentially calls the template "Branch Visit" and adds it to the record so the next time the record is opened, it displays.

 

Brian, I like your recommendation using the Planned Task related list but how would I be able to make that "mobile friendly" in such a way where those tasks appear in-line on the form itself?