xowf::WorkflowPage instproc get_action_obj (public)

 <instance of xowf::WorkflowPage[i]> get_action_obj -action action 

Defined in /var/www/openacs.org/packages/xowf/tcl/xowf-procs.tcl

Check if the action can be executed in the current state, and if so, return the action_obj.

Switches:
-action (required)

Testcases:
create_workflow_with_instance
Source code:
set ctx [::xowf::Context require [self]]
#
# First try to call the action in the current state
#
foreach a [$ctx get_actions] {
  if {[namespace tail $a] eq "$action"} {
    # In the current state, the specified action is allowed
    :log  "--xowf action $action allowed -- name='${:name}'"
    return $a
  }
}
#
# Some actions are state-safe, these can be called in every state
#
set actionObj [$ctx wf_definition_object $action]
if {[nsf::is object $actionObj] && [$actionObj state_safe]} {
  # The action is defined as state-safe, so if can be called in every state
  :log  "--xowf action $action state_safe -- name='${:name}'"
  return $actionObj
}
error "No state-safe action '$action' available in workflow instance [self] of  [${:page_template} name] in state [$ctx get_current_state]\n Available actions: [[$ctx current_state] get_actions]"
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: