WorkflowDuration - Global

This class calculates the duration (in seconds) based on the variables of a workflow activity. It is an interface between Workflow Timer() and DurationCalculator().

WorkflowDuration - addSeconds(GlideRecord record, Number amount)

Adds the number of seconds to the specified start date/time.

Table 1. Parameters
Name Type Description
record GlideRecord description
amount Number amount
Table 2. Returns
TypeDescription
BooleanTrue, if object was successfully created.

WorkflowDuration - calculate(GlideRecord record)

Calculates the number of seconds and the due date.

Table 3. Parameters
Name Type Description
record GlideRecord The record that contains the fields with the schedule, timezone, and date/time information. This is almost always activity.vars.__var_record__.
Table 4. Returns
TypeDescription
void

WorkflowDuration - calculateTimeLeft(GlideRecord record)

Calculates the number of seconds remaining to the specified end date/time.

Table 5. Parameters
Name Type Description
record GlideRecord The record that contains the fields with the schedule, timezone, and date/time information. This is almost always activity.vars.__var_record__.
Table 6. Returns
TypeDescription
void

WorkflowDuration - getSeconds( )

Gets the seconds value that was set by a call to calculate(record).

Table 7. Parameters
Name Type Description
None
Table 8. Returns
TypeDescription
NumberThe number of seconds set by a call to calculate(record).

WorkflowDuration - getTotalSeconds( )

Gets the totalSeconds value that was set by a call to calculate(record).

Table 9. Parameters
Name Type Description
None
Table 10. Returns
TypeDescription
NumberThe total number of seconds set by a call to calculate(record).

WorkflowDuration - getEndDateTime( )

Gets the end date/time set by a call to calculate(record).

Table 11. Parameters
Name Type Description
None
Table 12. Returns
TypeDescription
GlideDateTimeThe end date/time.

WorkflowDuration - setEndDateTime(String dt)

Sets the end date/time to use when calculating the remaining time. To convert the value into the GlideDateTime internal format, use GlideDateTime.getValue().

To convert the value into the GlideDateTime internal format, use GlideDateTime.getValue().

Table 13. Parameters
Name Type Description
dt String The end date/time to use.
Table 14. Returns
TypeDescription
void

WorkflowDuration - setEndDateTime(GlideDateTime dt)

Sets the end date/time to use when calculating the remaining time. To convert the value into the GlideDateTime internal format, use GlideDateTime.getValue().

To convert the value into the GlideDateTime internal format, use GlideDateTime.getValue().

Table 15. Parameters
Name Type Description
dt GlideDateTime The end date/time to use.
Table 16. Returns
TypeDescription
void

WorkflowDuration - setStartDateTime(String dt)

Sets the start date/time to use in the calculations.

Table 17. Parameters
Name Type Description
dt String The start date/time to use, in GMT.
Table 18. Returns
TypeDescription
void

WorkflowDuration - setStartDateTime(GlideDateTime dt)

Sets the start date/time to use in the calculations. To convert the value into the GlideDateTime internal format, use GlideDateTime.getValue().

To convert the value into the GlideDateTime internal format, use GlideDateTime.getValue().

Table 19. Parameters
Name Type Description
dt GlideDateTime The start date/time to use.
Table 20. Returns
TypeDescription
void

WorkflowDuration - setUsedSecs(Number secs)

Sets the used seconds compensation, where the number of seconds is the number of seconds inside of any schedule. Can be a -ve number, which extends the duration.

Can be a -ve number, which extends the duration.

Table 21. Parameters
Name Type Description
secs Number The number of used seconds to set.
Table 22. Returns
TypeDescription
void

WorkflowDuration - setWorkflow(Object schedule, Object timezone)

Sets the workflow schedule/timezone. Used for schedule_type workflow_schedule and timezone_type workflow_timezone).

Table 23. Parameters
Name Type Description
schedule Object The schedule to use. Usually from the workflow context.schedule.
timezone Object The timezone to use. Usually from the workflow context.timezone.
Table 24. Returns
TypeDescription
void