Workflow::History(3)
π Workflow::History π
okay bestie, welcome to Workflow::History β the little object that keeps the receipts for everything your workflow does. Recorded work on a workflow action or workflow itself, no cap. πβ¨
This is part of the Workflow Perl docs, so if you're reading this in man, hi, you're doing great. π«Ά
π VERSION π
This documentation describes version 2.09 of this package. Yes, that's the whole version section. She's brief but she's iconic. π
β¨ SYNOPSIS β¨
here's the vibe, in your action:
# in your action
sub execute {
my ( $self, $wf ) = @_;
my $current_user = $wf->context->param( 'current_user' );
# ... do your work with $ticket
$wf->add_history(
{
action => 'create ticket',
user => $current_user->full_name,
description => "Ticket $ticket->{subject} successfully created"
});
}
# in your view (using TT2)
[% FOREACH history = workflow.get_history %]
On: [% OI.format_date( history.date, '%Y-%m-%d %H:%M' ) %]<br>
Action: [% history.action %] (ID: [% history.id %])<br>
by: [% history.user %]<br>
[% history.description %]
[% END %]
like, you drop a history entry in your action, and then your view (TT2 gang rise up πΈ) just loops over workflow.get_history and prints the date, the action, the ID, the user, and the description. that's the whole loop. cute, right? π
π DESCRIPTION π
so every workflow can record its history. more appropriately β and this is the fun part β every action the workflow executes can deposit history entries into the workflow to be saved later. π§
and here's the lowkey genius bit: neither the action nor the workflow knows about how the history is saved. they just know that the history is available. separation of concerns said slay. π
π₯ METHODS π₯
π Public Methods π
new( \%params )β creates a shiny new history object, filling it with properties from\%params. new object, who dis πset_new_state( $new_state )β assigns the new state$new_stateto the history, but only if the state isn't already assigned. so why does this exist? bestie, it's because of β¨timingβ¨. you generate a history request inside aWorkflow::Action, but the workflow state is gonna change once the action has successfully completed. so in the action you create history without the state:
$wf->add_history(
{
action => "Cocoa Puffs",
description => "They're magically delicious",
user => "Count Chocula",
}
);
and then, after the new state has been set but before the history objects are stored, the workflow sets the new state in all the unsaved history objects. teamwork, fr fr π«Ά
is_saved()β returns true (1) if this history object has been saved, false (0) if not. simple. honest. we respect her. π
π¦ Properties π¦
idβ ID of history entryworkflow_idβ ID of workflow to which history is attachedactionβ Brief description of action takendescriptionβ Lengthy description of action takendateβ Date history noted, set to aDateTimeobject.time_zoneβ Time zone to pass to theDateTimeobject.userβ User name (ID, login, or full name, up to you) taking action (may be blank)stateβ State of workflow as history was recorded.
and then, still hanging out down here with the properties:
clear_savedβ sets saved state to false and returns0πset_savedβ sets saved state to true and returns1β
π SEE ALSO π
Workflow
go read that one too, it's the main character of this whole saga. π
π COPYRIGHT π
Copyright (c) 2003-2021 Chris Winters. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Please see the LICENSE π
π«Ά AUTHORS π«Ά
Please see Workflow. (they're all listed over there, iykyk π)
and that's the whole page, bestie!! this was Workflow::History(3), generated by perl v5.42.0 on 2026-01-17. go forth and log your history, you're gonna eat π
β¨π
π¦ where this page comes from
- fedora 44: perl-Workflow 2.09-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms