Flows for APEX API Package (flow_api_pkg)

Package flow_api_pkg

The flow_api_pkg package gives you access to the Flows for APEX engine, and allows you to perform:

  • Flow Instance Operations, allowing you to Create, Start, Reset, Terminate and Delete a Process Instance.
  • Flow Step Operations, allowing you to Complete, Reserve, Release, or signal Starting a Process Step.

Flow Instance Operations:

These API functions allow you to control a process instance, i.e., one operation of the process defined in its process model / process diagram. These commands allow you to:

  • Create a process instance
  • Start an instance
  • Terminate an instance (stop all processing of an instance)
  • Reset an instance back to its newly created state
  • Delete an instance
  • Set the Instance priority
  • Set the Instance Due On timestamp.

Flow Step Operations:

These API functions allow you to control individual steps in a process instance. These commands allow you to:

  • Complete a Step, and move to the next process step
  • Reserve a Step
  • Release a reserved step
  • record that you are Starting work on a Step
  • Reschedule a step that is waiting on a timer

Application Helper Functions:

These API functions are provided as Application Helper functions from the Flows for APEX API. these commands allow you to:

  • get the URL of the current userTask
  • get an engine Error Message in a supported language
  • return the result of an APEX Approval task to its Flows for APEX process instance upon completion

Types

Type t_task_list_item

type t_task_list_item is record 
   ( manager                 varchar2( 20)
   , app_id                  number
   , task_id                 number
   , task_def_id             number
   , task_def_name           varchar2( 255)
   , task_def_static_id      varchar2( 255)
   , subject                 varchar2(1000)
   , task_type               varchar2(  32)
   , details_app_id          number
   , details_app_name        varchar2( 255)
   , details_link_target     varchar2(4000)
   , due_on                  timestamp with time zone
   , due_in_hours            number
   , due_in                  varchar2( 255)
   , due_code                varchar2(  32)
   , priority                number(1)
   , priority_level          varchar2( 255)
   , initiator               varchar2( 255)
   , initiator_lower         varchar2( 255)
   , initiator_can_complete  varchar2(   1)
   , actual_owner            varchar2( 255)
   , actual_owner_lower      varchar2( 255)
   , potential_owners        varchar2(4000)
   , potential_groups        varchar2(4000)
   , excluded_owners         varchar2(4000)
   , state_code              varchar2(  32)
   , state                   varchar2( 255)
   , is_completed            varchar2(   1)
   , outcome_code            varchar2(  32)
   , outcome                 varchar2( 255)
   , badge_css_classes       varchar2( 255)
   , badge_text              varchar2( 255)
   , created_ago_hours       number
   , created_ago             varchar2( 255)
   , created_by              varchar2( 255)
   , created_on              timestamp with time zone
   , last_updated_by         varchar2( 255)
   , last_updated_on         timestamp with time zone
   , process_id              number
   , subflow_id              number
   , step_key                varchar2(20)
   , current_obj             varchar2(50)
);

Type t_task_list_items

type t_task_list_items is table of t_task_list_item;

Function flow_create

function flow_create (
   pi_dgrm_name in flow_diagrams.dgrm_name%type,
   pi_dgrm_version in flow_diagrams.dgrm_version%type default null,
   pi_prcs_name in flow_processes.prcs_name%type default null,
   pi_logging_level in flow_processes.prcs_logging_level%type default null,
   pi_auto_commit in boolean default true
) return flow_processes.prcs_id%type;

This function creates a new process instance based on a diagram name and version (process specification) If the version is not specified, first lookup is to use dgrm_status = ‘released’ second lookup is to use dgrm_version = ‘0’ and dgrm_status = ‘draft’ If nothing is found based on above rules an exception will be raised. For accuracy, it is recommended that you specify a version or use the form of flow_create specifying dgrm_id directly.

The process instance is created with a logging level that is the higher of the logging level of the diagram and the logging level specified in the call. If the logging level is not specified, the logging level of the diagram is used.

This function returns the Process ID of the newly created process.

EXAMPLE

This example will create a new process instance called “My Instance Name” based on the model “My Model” in version “0”.

declare
   l_prcs_id flow_processes.prcs_id%type;
begin
   l_prcs_id := flow_api_pkg.flow_create(
        pi_dgrm_name    => 'My Model'
      , pi_dgrm_version => '0'
      , pi_prcs_name    => 'My Instance Name'
   );
end;

Function flow_create

function flow_create (
   pi_dgrm_id in flow_diagrams.dgrm_id%type,
   pi_prcs_name in flow_processes.prcs_name%type default null,
   pi_logging_level in flow_processes.prcs_logging_level%type default null,
   pi_auto_commit in boolean default true
) return flow_processes.prcs_id%type;

This function creates a new process instance based on a diagram id (process specification) and returns the Process ID of the newly created process

The process instance is created with a logging level that is the higher of the logging level of the diagram and the logging level specified in the call. If the logging level is not specified, the logging level of the diagram is used.

EXAMPLE

This example will create a new process instance called “My Instance Name” based on the model ID 1.

declare
   l_prcs_id flow_processes.prcs_id%type;
begin
   l_prcs_id := flow_api_pkg.flow_create (
        pi_dgrm_id    => 1
      , pi_prcs_name    => 'My Instance Name'
   );
end;

Procedure flow_create

procedure flow_create (
   pi_dgrm_name in flow_diagrams.dgrm_name%type,
   pi_dgrm_version in flow_diagrams.dgrm_version%type default null,
   pi_prcs_name in flow_processes.prcs_name%type default null,
   pi_logging_level in flow_processes.prcs_logging_level%type default null,
   pi_auto_commit in boolean default true
);

Creates a new process instance based on a diagram name and version (process specification).

If the version is not specified:

  • first lookup is to use dgrm_status = ‘released’
  • second lookup is to use dgrm_version = ‘0’ and dgrm_status = ‘draft’

If nothing is found based on above rules an exception will be raised. For accuracy, it’s recommended that you specify a version or use the form of flow_create specifying dgrm_id directly.

The process instance is created with a logging level that is the higher of the logging level of the diagram and the logging level specified in the call. If the logging level is not specified, the logging level of the diagram is used.

EXAMPLE

This example will create a new process instance called “My Instance Name” based on the model “My Model” in version “0”. Logging level will be set to 4.

begin
   flow_api_pkg.flow_create(
        pi_dgrm_name    => 'My Model'
      , pi_dgrm_version => '0'
      , pi_prcs_name    => 'My Instance Name'
      , pi_logging_level => 4 
   );
end;

Procedure flow_create

procedure flow_create (
   pi_dgrm_id in flow_diagrams.dgrm_id%type,
   pi_prcs_name in flow_processes.prcs_name%type default null,
   pi_logging_level in flow_processes.prcs_logging_level%type default null,
   pi_auto_commit in boolean default true
);

This procedure creates a new process instance based on a diagram id and version (process specification)

The process instance is created with a logging level that is the higher of the logging level of the diagram and the logging level specified in the call. If the logging level is not specified, the logging level of the diagram is used.

EXAMPLE

This example will create a new process instance called “My Instance Name” based on the model ID 1, and with full logging.

begin
   flow_api_pkg.flow_create(
         pi_dgrm_id      => 1
      , pi_prcs_name     => 'My Instance Name'
      , pi_logging_level => 8
   );
end;

Procedure flow_start

procedure flow_start (
   p_process_id in flow_processes.prcs_id%type
);

This procedure is use to start a process that was previously created by flow_create. It will will find the none Start event in the Flow diagram, and step the instance forward from the Start event.

EXAMPLE

This example will create a new process instance called “My Instance Name” based on the model “My Model” in version “0” and start it.

declare
   l_prcs_id flow_processes.prcs_id%type;
begin
   l_prcs_id := flow_api_pkg.flow_create(
        pi_dgrm_name    => 'My Model'
      , pi_dgrm_version => '0'
      , pi_prcs_name    => 'My Instance Name'
   );

   flow_api_pkg.flow_start(
      p_process_id => l_prcs_id
   );
end;

Procedure flow_reset

procedure flow_reset (
   p_process_id in flow_processes.prcs_id%type,
   p_comment in flow_instance_event_log.lgpr_comment%type default null
);

This procedure is used, typically during model development and testing only, to reset an existing Instance to the state it would be at after it was created, but not yet started. All Process Variables, except built-ins, are deleted. This is not meant for use in Production Systems.

EXAMPLE

This example will reset the process instance that have the ID 1.

begin
   flow_api_pkg.flow_reset(
        p_process_id   => 1
      , p_comment      => 'Reset Process Instance using the PL/SQL API'
   );
end;

Procedure flow_terminate

procedure flow_terminate (
   p_process_id in flow_processes.prcs_id%type,
   p_comment in flow_instance_event_log.lgpr_comment%type default null
);

This procedure is used, typically by an administrator, to permanently stop processing of the Instance (which will be lefty in a status of terminated).

EXAMPLE

This example will terminate the process instance that have the ID 1.

begin
   flow_api_pkg.flow_terminate(
        p_process_id    => 1
      , p_comment => 'Process Instance Terminated using the PL/SQL API'
   );
end;

Procedure flow_delete

procedure flow_delete (
   p_process_id in flow_processes.prcs_id%type,
   p_comment in flow_instance_event_log.lgpr_comment%type default null
);

This procedure is used to remove an Instance from the system. All instances, subflows, and variables are deleted from the operational system. If event logging was enabled while the process was running, records in the event logs are maintained for auditing purposes.

EXAMPLE

This example will delete the process instance that have the ID 1.

begin
   flow_api_pkg.flow_delete(
        p_process_id => 1
      , p_comment    => 'Delete Process Instance using the PL/SQL API'
   );
end;

Procedure flow_set_priority

procedure flow_set_priority (
   p_process_id in flow_processes.prcs_id%type,
   p_priority   in flow_processes.prcs_priority%type
);

This procedure is used to update the priority of a process instance. The initial process priority will be set from the process diagram definition, but this procedure can be used to reset the priority while the instance is running. Values from 1 (highest priority) to 5 (lowest priority)

EXAMPLE

This example will update the process instance priority to 1 (most urgent) for process instance 345.

begin
   flow_api_pkg.flow_set_priority(
        p_process_id => 345
      , p_priority   => 1
   );
end;

Procedure flow_set_due_on

procedure flow_set_due_on (
   p_process_id in flow_processes.prcs_id%type,
   p_due_on     in flow_processes.prcs_due_on%type
);

This procedure is used to update the Due On timestamp of a process instance. The initial process Due On date (actually a timestamp with time zone) will be set from the process diagram definition, but this procedure can be used to reset the Due On while the instance is running. Due On date values should be a Timestamp with Time Zone.

EXAMPLE

This example will update the process instance due_on timestamp to 31 Dec 2027 at 14:30 GMT for process instance 345.

begin
   flow_api_pkg.flow_set_due_on(
        p_process_id => 345
      , p_due_on     => to_timestamp_tz ( '31-DEC-2027 14:30:00 GMT', 'DD-MON-YYYY HH24:MI:SS TZR')
   );
end;

Procedure flow_start_step

procedure flow_start_step (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type default null
);

This procedure is an optional command that can be used in applications to signal that a user is about to start working on a task. This is only used to differentiate ‘waiting’ time from ‘processing’ time in system logs to aid process management and statistics. A ‘good-practice’ app would issue this call when work is about to start on a task, for example, from a page loading process.

Use this in conjunction with flow_pause_step to indicate that the work is paused on a task.

flow_start_step requires event logging to be running at the ‘detailed` level or higher to be effective.

EXAMPLE

This example will use this procedure to indicate that the work is started for the task that have the subflow ID 3 in the process ID 1.

begin
   flow_api_pkg.flow_start_step(
        p_process_id => 1
      , p_subflow_id => 3 
      , p_step_key   => 'NqOiEHUbAF'
   );
end;

Procedure flow_pause_step

procedure flow_pause_step (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type default null
);

This procedure is an optional command that can be used in conjunction with flow_start_step in applications to signal that a user has paused working on a task. This is only used to differentiate ‘waiting’ time from ‘processing’ time in system logs to aid process management and statistics. A ‘good-practice’ app would issue this call when work on a task is saved but the workflow task is not completed, for example, from a page save process that did not include a ‘flow_complete_step’.

If flow_start_step has not been called, this procedure will have no effect.

‘flow_pause_step’ requires event logging to be running at the detailed level or higher to be effective.

EXAMPLE

This example will use this procedure to indicate that the work has paused on the task that have the subflow ID 3 in the process ID 1.

begin
   flow_api_pkg.flow_pause_step(
        p_process_id => 1
      , p_subflow_id => 3 
      , p_step_key   => 'NqOiEHUbAF'
   );
end;

Procedure flow_reserve_step

procedure flow_reserve_step (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type default null,
   p_reservation in flow_subflows.sbfl_reservation%type
);

This procedure is used to signal to other users that a user is going to handle this task (see the documentation on reservations).

EXAMPLE

This example will reserve the step in process ID 1 and subflow ID 3 for the current user.

begin
   flow_api_pkg.flow_reserve_step(
        p_process_id  => 1
      , p_subflow_id  => 3 
      , p_step_key    => 'NqOiEHUbAF'
      , p_reservation => :APP_USER
   );
end;

Procedure flow_release_step

procedure flow_release_step (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type default null
);

This procedure is used to remove a reservation (see the documentation on reservations).

EXAMPLE

This example will release the reservation for a step in process ID 1 and subflow ID 3 for the current user.

begin
   flow_api_pkg.flow_release_step(
        p_process_id => 1
      , p_subflow_id => 3 
      , p_step_key   => 'NqOiEHUbAF'
   );
end;

Procedure flow_complete_step

procedure flow_complete_step (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type default null
);

This procedure is used to tell the flow engine that the current step is complete, and to move the instance forward to the next step.

EXAMPLE

This example will complete a step in process ID 1 and subflow ID 3 for the current user.

begin
   flow_api_pkg.flow_complete_step(
        p_process_id  => 1
      , p_subflow_id  => 3 
      , p_step_key    => 'NqOiEHUbAF'
   );
end;

Procedure flow_restart_step

procedure flow_restart_step (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type default null,
   p_comment in flow_instance_event_log.lgpr_comment%type default null
);

This procedure is designed to be called by an administrator to restart, for example, a scriptTask or serviceTask that has failed due to an error. The intended usage is that the administrator can fix the script or edit the process data that caused the task to fail, and then restart the task using this call. A comment can optionally be provided, which will be added to the task event log entry. It should only be used on a subflow having a status of ‘error’

EXAMPLE

This example will restart a step in process ID 1 and subflow ID 3.

begin
   flow_api_pkg.flow_restart_step(
        p_process_id  => 1
      , p_subflow_id  => 3
      , p_step_key    => 'NqOiEHUbAF' 
   );
end;

Procedure flow_reschedule_timer

procedure flow_reschedule_timer (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type default null,
   p_is_immediate in boolean default false,
   p_new_timestamp in flow_timers.timr_start_on%type default null,
   p_comment in flow_instance_event_log.lgpr_comment%type default null
);

flow_reschedule_timer can be called to change the next scheduled time of a timer on a running timer. It can change the currently scheduled time to a future time, or can instruct the timer to fire immediately. If the Timer event is a single event timer (timer types Date or Duration), it will change the time at which the event is scheduled to occur to the new time. If the timer is a Cycle Timer, this changes the time that the next firing is scheduled to occur. If later cycles exist, the following cycle will be scheduled at the new firing time + the repeat interval. To fire the timer immediately, set p_is_immediate = true. It should then run on the next timer cycle, usually within a few seconds. To change the firing time to another future time, supply a new timestamp with time zone containing the new time. A comment can be provided, which is passed to the log file for explanation of any rescheduling.

EXAMPLE

This example causes a waiting step in process ID 1 and subflow ID 3 to occur immediately.

begin
   flow_api_pkg.flow_reschedule_timer(
        p_process_id   => 1
      , p_subflow_id   => 3 
      , p_step_key     => 'NqOiEHUbAF'
      , p_is_immediate => true
   );
end;

This example causes a waiting step in process ID 1 and subflow ID 3 to be rescheduled for a future time (+2 days).

begin
   flow_api_pkg.flow_reschedule_timer(
        p_process_id    => 1
      , p_subflow_id    => 3 
      , p_step_key      => 'NqOiEHUbAF'
      , p_new_timestamp => systimestamp + 2
   );
end;

Function get_current_tasks

function get_current_tasks (
   p_context    in varchar2 default flow_constants_pkg.gc_task_list_context_my_tasks,
   p_prcs_id    in flow_processes.prcs_id%type default null,
   p_user       in varchar2 default null,
   p_groups     in varchar2 default null
) return t_task_list_items pipelined;

This function is a pipelined table function which is used to create the Flows for APEX task list. Depending upon the value of p_context, the data returned by the function varies.

For p_context = ‘MY_TASKS’, the task list generated shows the current userTasks for the user. For p_context = ‘SINGLE_PROCESS’, the task list generated shows all of current userTasks and Approval tasks for process instance p_prcs_id. This is used by the Task Monitor of the Flows for APEX application.

Function get_current_usertask_url

function get_current_usertask_url (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type default null,
   p_scope in flow_subflows.sbfl_scope%type default 0
) return varchar2;

This function returns the URL for the current task on the specified subflow.

EXAMPLE

This example show how to get the current task url for process ID 1 and subflow ID 3.

declare
   l_url varchar2(4000);
begin
   l_url := flow_api_pkg.get_current_usertask_url(
        p_process_id => 1
      , p_subflow_id => 3
      , p_step_key   => 'NqOiEHUbAF'
   );
end;

Function message

function message (
   p_message_key in varchar2,
   p_lang in varchar2 default 'en',
   p0 in varchar2 default null,
   p1 in varchar2 default null,
   p2 in varchar2 default null,
   p3 in varchar2 default null,
   p4 in varchar2 default null,
   p5 in varchar2 default null,
   p6 in varchar2 default null,
   p7 in varchar2 default null,
   p8 in varchar2 default null,
   p9 in varchar2 default null
) return varchar2;

This function returns a Flows for APEX error message with p0…p9 substitutions in p_lang.

EXAMPLE

This example show how to get the “gateway-no-route” message in french.

declare
   l_message varchar2(4000);
begin
   l_message := flow_api_pkg.message(
        p_message_key => 'gateway-no-route'
      , p_lang        => 'fr'
      , p0            => 'Variable Name'
   );
end;

Procedure return_approval_result (DEPRECATED)

procedure return_approval_result (
   p_process_id in flow_processes.prcs_id%type,
   p_apex_task_id in number,
   p_result in flow_process_variables.prov_var_vc2%type default null
);

⚠️ DEPRECATED - Use procedure return_task_state_outcome

A convenience procedure for returning an APEX Approval result into a Flows for APEX process when the task has ben completed or otherwise changed state. This procedure checks the Task ID is valid, stores p_result into the return variable (as defined in the process diagram), then performs a flow_complete_step to move to the next step.

This can be called from an APEX Human Task (Approval Task) Action step. Note that you can also use the APEX Approval Return Result process plug-in to do this declaratively in your application.

EXAMPLE

This code could be defined in an APEX Approval Task Action definition when a task is completed (on approval and on rejection).
In this example, we have an APEX Approval parameter PROCESS_ID which contains the Flows for APEX process ID. The values for p_task_id and p_result are

flow_api_pkg.return_approval_result ( p_process_id      => :PROCESS_ID,
                                      p_apex_task_id    => :APEX$TASK_ID,
                                      p_result          => :APEX$TASK_OUTCOME);

Procedure return_task_state_outcome

procedure return_task_state_outcome (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key in flow_subflows.sbfl_step_key%type,
   p_apex_task_id in number,
   p_state_code in apex_tasks.state_code%type,
   p_outcome in flow_process_variables.prov_var_vc2%type default null
);

From Flows for APEX 25.1. Use this in preference to return_approval_result, which is now deprecated.

A convenience procedure for returning an APEX Human Task (Approval or Action Task) result and state into a Flows for APEX process when the task has ben completed or otherwise changed state. This procedure checks the Task ID is valid, stores p_result into the return variable (as defined in the process diagram), then performs a flow_complete_step to move to the next step.

This can be called from an APEX Human Task (Approval or Action Task) Action step. Note that you can also use the APEX Human Task Return State and Outcome process plug-in to do this declaratively in your application.

EXAMPLE

This code could be defined in an APEX Approval Task Action definition when a task is completed (on approval and on rejection).
In this example, we have an APEX Approval parameter PROCESS_ID which contains the Flows for APEX process ID. The values for p_task_id and p_result are

flow_api_pkg.return_task_state_outcome ( p_process_id      => :PROCESS_ID,
                                         p_apex_task_id    => :APEX$TASK_ID,
                                         p_outcome         => :APEX$TASK_OUTCOME,
                                         p_state_code      => :APEX$TASK_STATE);

Function get_task_potential_owners

function get_task_potential_owners (
   p_process_id in flow_processes.prcs_id%type,
   p_subflow_id in flow_subflows.sbfl_id%type,
   p_step_key   in flow_subflows.sbfl_step_key%type,
   p_separator  in varchar2 default ','
) return flow_process_variables.prov_var_vc2%type;

This function returns the list of potential owners for a task in a process instance. The list is returned as a string, with the values separated by the p_separator value (default is comma).
Intended usage is to allow an APEX Human Task to get the list of potential owners for a task from its Flows for APEX process instance.

Note that APEX Human Tasks require the list to be a comma separated list, so the default value of p_separator is a comma. If you are using this function in a different context, you can specify a different separator.

EXAMPLE

This code could be defined in the Participants section of an APEX Human Task (Approval Task or Action Task) definition. Having set Task Parameters for PROCESS_ID, SUBFLOW_ID and STEP_KEY, you can use this function to get the list of potential owners for the task. Define the Participant to be: Potential Owners Define the type to be an: Expression Define the Expression to be:

flow_api_pkg.get_task_potential_owners ( p_process_id => :PROCESS_ID,
                                         p_subflow_id => :SUBFLOW_ID,
                                         p_step_key   => :STEP_KEY)

Function get_task_business_admins

function get_task_business_admins (
   p_process_id         in flow_processes.prcs_id%type,
   p_subflow_id         in flow_subflows.sbfl_id%type,
   p_step_key           in flow_subflows.sbfl_step_key%type,
   p_separator          in varchar2 default ',',
   p_add_diagram_admin  in boolean default false,
   p_add_instance_admin in boolean default false
) return flow_process_variables.prov_var_vc2%type;

This function returns the list of business admins for a task in a process instance. The list is returned as a string, with the values separated by the p_separator value (default is comma).
Intended usage is to allow an APEX Human Task to get the list of business admins for a task from its Flows for APEX process instance.

If p_add_diagram_admin is true, the business admin defined in the bpmn:process object on the BPMN diagram will also be added to the list of business admins.

If p_add_instance_admin is true, the business admin defined in the system configuration parameter default_apex_business_admin will also be added to the list of business admins.

Note that APEX Human Tasks require the list to be a comma separated list, so the default value of p_separator is a comma. If you are using this function in a different context, you can specify a different separator.

EXAMPLE

This code could be defined in the Participants section of an APEX Human Task (Approval Task or Action Task) definition. Having set Task Parameters for PROCESS_ID, SUBFLOW_ID and STEP_KEY, you can use this function to get the list of business admins for the task. Define the Participant to be: Business Admins Define the type to be an: Expression
Define the Expression to be:

flow_api_pkg.get_task_business_admins ( p_process_id => :PROCESS_ID,
                                        p_subflow_id => :SUBFLOW_ID,
                                        p_step_key   => :STEP_KEY)

Procedure receive_message

procedure receive_message (
   p_message_name  flow_message_subscriptions.msub_message_name%type,
   p_key_name      flow_message_subscriptions.msub_key_name%type,
   p_key_value     flow_message_subscriptions.msub_key_value%type,
   p_payload       clob default null
);

This procedure is used to deliver a message to a waiting message event in a process instance.

For more information on message events, see the documentation.

EXAMPLE

flow_api_pkg.receive_message ( p_message_name  => 'CustomerPOReceived',
                                p_key_name      => 'PONumber',
                                p_key_value     => 'PO12345',
                                p_payload       => '{"PONumber" : "PO12345", 
                                                     "Amount": 1234.56, 
                                                     "Currency": "USD",
                                                     "CustomerID": "CUST001"}' );

Function intervalDStoSec

function intervalDStoSec (
   p_intervalDS  interval day to second
) return number;

This function returns the number of seconds in an interval day to second value.

EXAMPLE

SELECT flow_api_pkg.intervalDStoSec ( INTERVAL '1 12:30:00' DAY TO SECOND ) FROM dual;

returns 131,400 seconds (1 day, 12 hours, 30 minutes)

Function intervalDStoHours

function intervalDStoHours (
   p_intervalDS  interval day to second
) return number;

This function returns the number of hours in an interval day to second value.

EXAMPLE

SELECT flow_api_pkg.intervalDStoHours ( INTERVAL '1 12:30:00' DAY TO SECOND ) FROM dual;

returns 36 hours (1 day, 12 hours, 30 minutes)

Procedure step_timers

procedure step_timers;

This procedure is used to manually step timers forward in a process instance when debugging, testing or demoing a process.

EXAMPLE

flow_api_pkg.step_timers;