Home > Back-end >  Oracle Apex How to pass item values in page redirect between applications that are not in session
Oracle Apex How to pass item values in page redirect between applications that are not in session

Time:09-16

I'm using Oracle Apex 5.1.

Let's say that I have two applications, with id's are 128 and 999. I have one page in application 128:10 that has a button to redirect to a page in application 999:12, sending some values from items on page 128:10 to page items on 999:12.

Page 128:10 is normal DML page, page 999:12 is a modal page, so it opens over the 128:10 page.

Problem is when an item value that is being sent from page 128:10 is changed without submitting the page. Since the redirect button is rendered when the page is loaded, it's not redirecting with current item value, but with original item value. Submitting a page first is not an option.
Setting the button to submit a page, than a branch to page 999:12 doesn't work because page 999:12 is a modal page.

I don't know how or if it is possible to directly access item from page 999:12 that is on 128:10.

Something like :P12_ITEM := :P10_ITEM doesn't work since pages are in different applications.

Can anyone suggest how I can get the redirect to work sending current values from page 128:10 to page in 999:12, preferably without a complicated javascript solution ?

Thank you

CodePudding user response:

Create Dynamic action and execute it onClick button (P10_MY_URL item should be created as hidden):

1st true action:

DECLARE
    l_app number := v('APP_ID');
    l_session number := v('APP_SESSION');
BEGIN
    :P10_MY_URL:= APEX_UTIL.PREPARE_URL(
        p_url => 'f?p=999:12:'||l_session||'::NO::P12_ITEM:&P10_CURRENTPAGE_ITEM.',
        p_checksum_type => 'SESSION');
END;

Items to submit should contain any item you want to pass value from, in this case P10_MY_URL,P10_CURRENTPAGE_ITEM

Item to return should be P10_MY_URL

2nd true action:

javascript: window.location.href = apex.item('P10_MY_URL').getValue();

and thats it.

  • Related