Previous Next JavaScript must be enabled to correctly display this content

## 19.5.2 About Importing and Exporting Automations

After importing an application, automations are disabled. Learn how to enable automations after importing.

Developers often import applications into a workspace multiple times, for versioning or other purposes. If automations were enabled during these imports, this would lead to multiple instances of the automation running simultaneously which is not the desired result. Therefore, Oracle APEX disables automations after you import an application.

Example 1: Enable automation and start execution schedule immediately.

You can activate automations directly in Shared Components, Automations, or in Runtime Only environment by using the following PL/SQL block as shown in the following examples:

    declare
        l_app_id number := {new application ID};
    begin
        apex_session.create_session(
            p_app_id         => l_app_id,
            p_page_id        => {one of the application pages},
            p_username       => '{workspace user}');

        apex_automation.enable(
            p_application_id => l_app_id,
            p_static_id      => '{automation static ID}');
    end;

Example 2: Enable automation and set next execution timestamp explicitly

    declare
        l_app_id number := {new application ID};
    begin
        apex_session.create_session(
            p_app_id         => l_app_id,
            p_page_id        => {one of the application pages},
            p_username       => '{workspace user}');

        apex_automation.reschedule(
            p_application_id => l_app_id,
            p_static_id => '{automation static ID}',
            p_next_run_at => trunc( sysdate + 1 ) ); -- next midnight
    end;

See Also:

Editing an Existing Automation

Parent topic: Managing Automations