MIGRATE_INSTANCE Procedure

This procedure migrates a workflow instance to a newer version of the workflow. Use this procedure to update workflow variables, provide values for new required parameters, and specify the activity where the instance resumes.

Syntax

APEX_WORKFLOW.MIGRATE_INSTANCE (
    p_instance_id                   IN NUMBER,
    p_workflow_variables            IN APEX_WORKFLOW.T_WORKFLOW_PARAMETERS DEFAULT APEX_WORKFLOW.C_EMPTY_WORKFLOW_PARAMETERS,
    p_workflow_parameters           IN APEX_WORKFLOW.T_WORKFLOW_PARAMETERS DEFAULT APEX_WORKFLOW.C_EMPTY_WORKFLOW_PARAMETERS,
    p_resume_activity_static_id     IN VARCHAR2 DEFAULT NULL,
    p_continue_workflow             IN BOOLEAN DEFAULT FALSE );

Parameters

Parameter Description
p_instance_id ID of the Workflow instance to migrate.
p_workflow_variables Table of workflow variables to update during the migration.
p_workflow_parameters Table of workflow parameters to apply to the target version. You must provide values for all new required parameters in the target version.
p_resume_activity_static_id Static ID of the activity in the target version where the instance resumes.
p_continue_workflow Specifies whether the Workflow continues execution after migration. If FALSE, the instance is suspended. The default is FALSE.

Example

The following example migrates workflow instance 1001 to a newer workflow version, updates variables and parameters, and resumes execution at the ConfirmDelivery activity.

BEGIN
    apex_workflow.migrate_instance(
        p_instance_id => 1001,
        p_workflow_variables => apex_workflow.t_workflow_parameters(
            1 => apex_workflow.t_workflow_parameter(
                static_id => 'VAR1',
                string_value => 'VAL1' ),
            2 => apex_workflow.t_workflow_parameter(
                static_id => 'VAR2',
                string_value => 'VAL2' ) ),
        p_workflow_parameters => apex_workflow.t_workflow_parameters(
            1 => apex_workflow.t_workflow_parameter(
                static_id => 'PARAM1',
                string_value => 'foo' ),
            2 => apex_workflow.t_workflow_parameter(
                static_id => 'PARAM2',
                string_value => 'bar' ) ),
        p_resume_activity_static_id => 'ConfirmDelivery',
                p_continue_workflow => TRUE
);
END;