Apex 23.2 
Invoke API in FORM Region

Apex 23.2 Invoke API in FORM Region

I like to use Invoke API in Oracle Apex.

Here the Process:

but if i would use it within an Form Region:

I got:

not multiline Region:

I don't agree that i have to use a multiline Interactive Grid to use Invoke API Feature.
But it is so at the moment of writting.

How it works:
I need an dynamic Action for the Buttons:
Create, Save, Delete and make an Execute Server-side Code Action.
Calling an PL/SQL Code like this:

In my Package i got the values with GET_SESSION_STATE Calls.

Any better Ideas?

In my Package i can switch between IG handling and Other-Handling:

  PROCEDURE apex_modify_adm_params (
       p_component_type in varchar2 := 'IG',
       p_action CHAR := NULL)
    AS
        p_rec                   adm_params%ROWTYPE;
        c_procname              CONSTANT VARCHAR2 (100) := 'apex_modify_adm_params';
        p_page_id               NUMBER := APEX_UTIL.GET_SESSION_STATE('APP_PAGE_ID');
        l_action                char(2);

    BEGIN

        if p_component_type = 'IG' then
           l_action := APEX_UTIL.GET_SESSION_STATE('APEX$ROW_STATUS');
        else 
           l_action := p_action;
        end if;

        -- change p_record in table
        IF  p_component_type = 'IG' THEN
          p_rec.name                               := APEX_UTIL.GET_SESSION_STATE('NAME');
          p_rec.description                        := APEX_UTIL.GET_SESSION_STATE('DESCRIPTION');
          p_rec.value_type                         := APEX_UTIL.GET_SESSION_STATE('VALUE_TYPE');
          p_rec.value_text                         := APEX_UTIL.GET_SESSION_STATE('VALUE_TEXT');

        ELSE 
          p_rec.name                               := APEX_UTIL.GET_SESSION_STATE('P'||p_page_id||'_NAME');
          p_rec.description                        := APEX_UTIL.GET_SESSION_STATE('P'||p_page_id||'_DESCRIPTION');
          p_rec.value_type                         := APEX_UTIL.GET_SESSION_STATE('P'||p_page_id||'_VALUE_TYPE');
          p_rec.value_text                         := APEX_UTIL.GET_SESSION_STATE('P'||p_page_id||'_VALUE_TEXT');

        END IF;

        -- Create/Update
        IF l_action != 'D' THEN

          p_modify_adm_params (
             p_rec,
             p_action               => l_action,
             p_name=>p_rec.name
           );
        END IF;

        -- Delete
        IF l_action = 'D' THEN

           p_remove_adm_params (
             p_rec,
             p_name=>p_rec.name

        );
        END IF;


          IF  p_component_type = 'IG' THEN
           APEX_UTIL.SET_SESSION_STATE (p_name => 'NAME' , p_value     => p_rec.name,p_commit    => FALSE );
           APEX_UTIL.SET_SESSION_STATE (p_name => 'DESCRIPTION' , p_value     => p_rec.description,p_commit    => FALSE );
           APEX_UTIL.SET_SESSION_STATE (p_name => 'VALUE_TYPE' , p_value     => p_rec.value_type,p_commit    => FALSE );
           APEX_UTIL.SET_SESSION_STATE (p_name => 'VALUE_TEXT' , p_value     => p_rec.value_text,p_commit    => FALSE );
          ELSE 
           APEX_UTIL.SET_SESSION_STATE (p_name => 'P'||p_page_id||'_NAME' , p_value     => p_rec.name,p_commit    => FALSE );
           APEX_UTIL.SET_SESSION_STATE (p_name => 'P'||p_page_id||'_DESCRIPTION' , p_value     => p_rec.description,p_commit    => FALSE );
           APEX_UTIL.SET_SESSION_STATE (p_name => 'P'||p_page_id||'_VALUE_TYPE' , p_value     => p_rec.value_type,p_commit    => FALSE );
           APEX_UTIL.SET_SESSION_STATE (p_name => 'P'||p_page_id||'_VALUE_TEXT' , p_value     => p_rec.value_text,p_commit    => FALSE );
          END IF;

    END apex_modify_adm_params;

As you can see, if the IG is used then the Itemvalues are without PageId. If you use a Form you need to get the Values with PageID.

Hope that helps

Tom