How to print the time in millisecond after change of a field value?

vishaljaiswal
Giga Expert

Scenario: In a table like 'Incident', if their state changes from New to In Progress then i need to print the time in millisecond that in how much time their state changes from New to In Progress.

Note: There may be multiple incident record to check.

 

How to achieve this?

1 ACCEPTED SOLUTION

newhand
Mega Sage

@vishaljaiswal 

The field 'created_at' stores the date and time when the record was created. However, it only stores information at the second level, and milliseconds are not stored.

※All datetime fields work in this manner.

Therefore, you need to create a custom field to store the milliseconds when a record is created (state = new). Afterward, create a business rule (BR) to capture the state change and calculate the duration from [New] to [in Progress].

Finally, you can store the result in another custom field or simply print it to logs


Please mark my answer as correct and helpful based on Impact.

View solution in original post

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi @vishaljaiswal 

it's not really clear why you need this. I just can tell you that there is already a metrics definition available in your instance (URL: /nav_to.do?uri=metric_definition.do?sys_id=35f2b283c0a808ae000b7132cd0a4f55) which captures the duration between two state changes. So no need to calculate anything. Just use the corresponding metrics instance records.

Maik

newhand
Mega Sage

@vishaljaiswal 

The field 'created_at' stores the date and time when the record was created. However, it only stores information at the second level, and milliseconds are not stored.

※All datetime fields work in this manner.

Therefore, you need to create a custom field to store the milliseconds when a record is created (state = new). Afterward, create a business rule (BR) to capture the state change and calculate the duration from [New] to [in Progress].

Finally, you can store the result in another custom field or simply print it to logs


Please mark my answer as correct and helpful based on Impact.