How to get cost based on labor rate card and time card for a task?

sid_hegde
Giga Contributor

How can I relate the time spent on a Service Catalog Task to the Labor Rate Card to calculate the total cost of a resource for a task? I am trying to get the task to be listed in the expense lines in the Labor Rate Card form with the cost for each task.

4 REPLIES 4

drjohnchun
Tera Guru

Do you have a blended rate for all resources or individual labor rate. If the former, it's simply



Total Labor Cost for Task = sc_task.time_worked x blended_cost



If the latter, which more sounds like your case, and since a task might be worked on my more than one resource,



Total Labor Cost for Task = SUM( task_time_worked.time_worked x labor_rate(task_time_worked.user) ) for task_time_worked.task



So the table to use is task_time_worked [Time Worked] which tracks all time spent for all tasks. You'd filter (or join) this on the task reference field: sc_task.sys_id = task_time_worked.task



Then iterate over all rows you find, multiply task_time_worked.time_worked by the labor rate of task_time_worked.user, and sum them up for the total cost for the task.



Hope this helps.



Please feel free to connect, follow, mark helpful / answer, like, endorse.


John Chun, PhD PMP see John's LinkedIn profile

visit snowaid


ServiceNow Advocate

Winner of November 2016 Members' Choice Award


Hey John,



Can you please elaborate a little more on the above on how and where to use the above info to get the result that I am looking for.



Please note that I have created a Time Worked field on the Service Catalog task form and once the task is closed I need this time to generate an Expense Line in the Labor Rate Card for a particular resource.



I would appreciate it if you could please share screen shots of the process.



Thanks


Sid


Can you provide some details:



  1. Does only 1 resource always work on a task?
  2. How are you getting the labor rate for a resource? For example, are you using sys_user_group.hourly_rate [Hourly rate] or fm_labor_rate_card.rate_code [Rate code] and, if so, how do you look it up for a resource?
  3. Can you create only 1 Expense Line or is it OK to create multiple per a task (for example, if multiple resources are involved)?
  4. Do you use parent-child relationships for Expense Lines for a task (for example, if multiple resources are involved)?
  5. Do you insert Expense Lines only when a task is Closed (if so, what's the task value for Closed)? Or do you do that while a task is in progress?

drjohnchun
Tera Guru

FYI, time_worked is a duration field type. task_time_worked.time_in_seconds gives time worked in seconds.