How to report difference between a catalog item variable and catalog task closure date?

Sachin G K1
Kilo Sage

Hi All,

 

I have a catalog item "abc" with a variable called Termination Date. It generates one catalog task (sc_task). I want to create a report  that shows the difference between the Termination Date (from RITM variable) and the task's closure date. What’s the best way to achieve this?

 

 

Thanks in Advance,

Sachin

2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@Sachin G K1 

1 easy way

1) store the termination date variable value in custom field on sc_task

2) then report on sc_task table and use function field to find the difference between the variable and task closure date/time

Function Fields in ServiceNow Reports: Calculate and Display Data on the Fly 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

@Sachin G K1 

don't show that field on form, remove it from form view

You can enhance the BR to work only for particular sc task

For older records you can use fix script to update the custom field with variable value.

I believe I have answered your question with the approach and you can take it further from here.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

6 REPLIES 6

Chaitanya ILCR
Kilo Patron

Hi @Sachin G K1 , 

It's might not be possible but check this out 

 

https://www.servicenow.com/community/developer-forum/function-field-using-datediff-task-due-date-and...

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Ankur Bawiskar
Tera Patron
Tera Patron

@Sachin G K1 

1 easy way

1) store the termination date variable value in custom field on sc_task

2) then report on sc_task table and use function field to find the difference between the variable and task closure date/time

Function Fields in ServiceNow Reports: Calculate and Display Data on the Fly 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar ,
How to "store the termination date variable value in custom field on sc_task"

@Sachin G K1 

you can use before insert business rule on sc_task and set it like this

current.u_custom_datetime = current.request_item.variables.terminationDateVariable;

OR

You can also use Flow Designer Catalog Task if you are using Flow and set the custom field value

If my response helped please mark it correct and close the thread so that it benefits future readers.

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