| Class | OpenWFE::SaveWorkItemExpression |
| In: |
lib/openwfe/expressions/fe_save.rb
|
| Parent: | FlowExpression |
Saves a copy of the current workitem to a variable or saves the attributes of the current workitem into a field (of that current workitem).
save :to_variable => "/wix"
#
# saves a copy of the current workitem to the process
# level variable "wix"
save :to_field => "old_version"
#
# saves a copy of the current workitem attributes in the
# field 'old_version' of that current workitem.
‘save’ is often used in conjuntion with ‘restore’ (RestoreWorkItemExpression).
# File lib/openwfe/expressions/fe_save.rb, line 72
72: def apply (workitem)
73:
74: field = lookup_string_attribute :to_field, workitem
75: variable = lookup_string_attribute :to_variable, workitem
76:
77: wi = workitem.dup
78:
79: if field
80:
81: workitem.set_attribute field, wi.attributes
82:
83: elsif variable
84:
85: set_variable variable, wi
86: end
87:
88: # else, simply don't save
89:
90: reply_to_parent workitem
91: end