Workspace: Recording Time in CSM



This article focuses on recording time on Cases within the Customer Service Management application. This can also be applied to Field Service Management if you're using that application as well.


I didn't intend on writing another article before the end of 2020, but I guess I love blogging because here I am.


Most of us have been using the Time Worked timer in the Platform UI for years. Recently, I found out the timer field is not supported in Workspace. Per a previous discussion on the SNDevs Slack, it seems like this is due to the tabbed interface of Workspaces, as users can have multiple tasks available at once, and the time worked timer probably had some complications accurately reporting time within tabs. If anyone knows for sure, please leave a comment.


If you try to add the Time Worked field to a Workspace, you'll see a little note stating '* Field type timer is not supported.'



In the Orlando release, ServiceNow added a Record Time UI Action to the Case and Case Task table in CSM (all the good stuff comes out for CSM) with the Time Recording for Customer Service plugin.


Clicking on the Record Time UI Action will bring up the Time Worked form where the user can enter their details:


After submitting we can see a Time card was generated (or updated if there is a time card already)



You can add the Time Worked related list to the Case form (workspace view) to see all of the entries on the table. This feature will also generate a Time Card (there's a related list for that too) when users record time.





I started to go down the route of implementing this for ITSM, but since this feature requires both CSM and Time Recording for CSM, I stopped right there due to licensing/subscription questions. I'm sure a custom feature that mimics the functionality can be created for ITSM, or perhaps the functionality ported over to ITSM but definitely check with your account representative before performing any Insert and Stays on that UI Action.


As a proof of concept, in my PDI I performed an Insert and Stay on Record Time, set the conditions to gs.hasRole('itil'), and placed the Time Worked related list on Incident. I did notice that Time Cards were not generated automatically. So I dug a little deeper and found a Script Include called: TimeRecordingHelper that has the following script:


TimeRecordingHelper.taskEnabledForTimeRecording = function(timeWorked) {

	// checking if enabled for fsm
	if (new GlidePluginManager().isActive('com.snc.time_recording_fsm') && gs.hasRole("wm_read")) {
		if (timeWorked.task.nil())
			return true; // support task worked entries with non-task categories
		var taskGR = timeWorked.task.getRefRecord();
		var taskTableName = taskGR.getTableName();
		if (taskTableName == 'wm_task' || taskTableName == 'wm_order')
			return true;
	}

	// checking if enabled for csm
	if (new GlidePluginManager().isActive('com.snc.csm_time_recording') && gs.hasRole("sn_customerservice_agent")) {

		if (timeWorked.task.nil())
			return true; // support task worked entries with non-task categories
		var taskCaseGR = timeWorked.task.getRefRecord();
		var caseTableName = taskCaseGR.getTableName();

		if (caseTableName == 'sn_customerservice_case' || caseTableName == 'sn_customerservice_task')
			return true;
	}

	return false;
};

This is why we can't create Time Cards from Time Worked from the Record Time UI Action by just copying the button or even manually, I tried adding Time Worked but the Script Include controls it all, but you can add in your table to the script and have it work. Again, this is hacky, still requires the plugins, and probably breaks some licensing rules but *does* make it work. What's interesting is the Task Time Worked (task_time_worked) table is part of the Service Management Basics plugin, which makes me think it still has some features to come out.


if (caseTableName == 'sn_customerservice_case' || caseTableName == 'sn_customerservice_task' || caseTableName == 'incident')
			return true;
	}

I don't know why ServiceNow hasn't put this feature out for ITSM yet, only CSM and FSM. Perhaps they will in an upcoming release. I've found that a lot of task based features for Workspace usually come out with CSM first. You can definitely create your own custom solution, I just really like the OOTB one because it's already put together and just works. The only downside I can see is not stating the timer automatically when a user views the record, but every organization's process is different in respect to recording task time. I'm not sure if ServiceNow will add on to this feature, but I could see something like preventing a user from closing a case with no Task Time Worked entries would be helpful to circumvent the timer issue.


Thanks for reading everyone and Happy New Year!


Resources


ServiceNow Documentation: Time Recording for Customer Service Management

116 views0 comments

Recent Posts

See All