Skip to content

DAYS_SPENT_IN_STATE

Description

DAYS_SPENT_IN_STATE returns the total number of days a case has spent (or has so far spent) in a given state, based on the case's transition history.

You can pass the state positionally or using the named argument state.

If you need the result in hours rather than days, use HOURS_SPENT_IN_STATE.

The optional arguments that narrow what counts are described under counting elapsed time.

Example

DAYS_SPENT_IN_STATE('in_review')

This returns the number of days the current case has spent in the in_review state.

Example with named argument

DAYS_SPENT_IN_STATE(state: 'in_review')

Arguments

DAYS_SPENT_IN_STATE accepts the same narrowing arguments as DAYS_BETWEEN, so DAYS_SPENT_IN_STATE(state: 'in_review', exclude_weekends: true) counts working days only. Naming any one of them means the state has to be named as well.

Info

New in Atfinity 17. A named argument that is neither state nor one of the narrowing arguments is rejected, where it was previously ignored.