Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Can I use the function field to capture time & date when status changes?

JLeong
Mega Sage

Hi Guys,

 

How can I create a report to show a time & date when an incident changes from "Pending" to "Work in Progress".

Could I use the function field in the report? I am not sure how?

 

Thanks in advance.

 

 

2 ACCEPTED SOLUTIONS

John Dahl
Kilo Sage

I would not go down the function field route... even if it works as expected, it might get more complicated than necessary. Since a record can get into the "Pending" state multiple times and for various reasons, you will want to determine if you want to track the first time, the last time, or any particular conditions that were active when the state change occurred. Two options that will give you precise control to track only the value you need are listed below:

  • You can create a metric on the table that will tell you when the state changed and you can report on that.
  • You can just create a simple date field that is set by a business rule or flow when the state changes.

Either of the options above should work and might provide a means that you and your team are already familiar with. 

View solution in original post

The start and end will be important for metrics where you want to track the duration in which a record was in a specific state (i.e. Pending). If your concern is something different and you don't care how long a record was in the pending state, then you can use a scripted metric. This gives you a lot of flexibility to look at the record values to determine if the current change is the one you want to track. For example, maybe you only want to know when the record changes to WIP after an attachment has been added to the record. A script can enable you to check for an attachment, and if found, set the metric calculate accordingly.

 

https://docs.servicenow.com/bundle/utah-platform-administration/page/use/reporting/task/create-metri...

View solution in original post

7 REPLIES 7

mkdangi21
Giga Expert
  1. Create a new report: a. Navigate to "Reports" > "Create New". b. Select the "Table" report type. c. Choose the "Incident" table as the data source.

  2. Configure the report filters: a. Click "Add Filter Condition". b. Set the filter to "State", "changes from", and "Pending". c. Click the "+" icon to add another filter condition. d. Set the second filter to "State", "changes to", and "Work in Progress".

  3. Create a function field to capture the date and time of the status change: a. Click "Add Function Field". b. Choose the "Function" type as "Date/Time". c. Select "Created" as the input field. d. Choose "Audit History" as the input source. e. Set the function to "Max". f. Name the function field "Status Change Timestamp".

  4. Configure the report columns: a. Click "Edit Columns". b. Add the following columns: "Number", "Short Description", "State", and "Status Change Timestamp". c. Click "Done".

  5. Save and run the report: a. Click "Save" and give your report a meaningful name. b. Run the report by clicking "Run".

Hi mkdangi21,

 

Thank you so much for responding to my question. I got so excited to see your email. In the filter condition, I don't see "changes from". Can I add this? If so, do you know how?

 

Thank you!

I also don't see the Audit history 😞

John Dahl
Kilo Sage

I would not go down the function field route... even if it works as expected, it might get more complicated than necessary. Since a record can get into the "Pending" state multiple times and for various reasons, you will want to determine if you want to track the first time, the last time, or any particular conditions that were active when the state change occurred. Two options that will give you precise control to track only the value you need are listed below:

  • You can create a metric on the table that will tell you when the state changed and you can report on that.
  • You can just create a simple date field that is set by a business rule or flow when the state changes.

Either of the options above should work and might provide a means that you and your team are already familiar with.