def apply
h.to = attribute(:to) || attribute(:on)
h.upon = UPONS[attribute(:upon) || 'apply']
h.upon = 'error_intercepted' if h.to == 'errors'
h.lmerge = attribute(:merge).to_s
h.lmerge = 'true' if h.lmerge == ''
h.lwfid = attribute(:wfid).to_s
h.lwfid = %w[ same current true ].include?(h.lwfid)
h.lwfid = true if h.to == 'errors'
persist_or_raise
@context.tracker.add_tracker(
h.lwfid ? h.fei['wfid'] : nil,
h.upon,
Ruote.to_storage_id(h.fei),
determine_condition,
{ 'action' => 'reply',
'fei' => h.fei,
'workitem' => 'replace',
'flavour' => 'listen' })
end