20231007 - Generate APEX URL in JavaScript



var vItemValue = 'New Item Value';

// Example 1 - get URL to set item value on page 1 with value from variable vItemValue
var vUrl = "f?p=" + $v( "pFlowId" ) + ":1:" + $v( "pInstance" ) + "::" + $v( "pdebug" ) + "::P1_ITEM:"+vItemValue;

// Example 2 - get URL to set item value on current page with value from variable vItemValue
var vUrl = "f?p=" + $v( "pFlowId" ) + ":" + $v( "pFlowStepId" ) + ":" + $v( "pInstance" ) + "::" + $v( "pdebug" ) + "::P1_ITEM:"+vItemValue;

// redirect to generated URL
apex.navigation.redirect(vUrl);

 


var vItemValue = 'New Item Value';

// Example 1 - just get URL to go to the page 1
vUrl = apex.util.makeApplicationUrl({pageId:1);

// Example 2 - go to page 1 and set value of item P1_ITEM
vUrl = apex.util.makeApplicationUrl({
  pageId:1,
  itemNames:['P1_ITEM'],
  itemValues:[vItemValue]
});

// Example 3 - you can also set multiple items
var vItem2Value = 'New Item 2 Value';
vUrl = apex.util.makeApplicationUrl({
  pageId:1,
  itemNames:['P1_ITEM', 'P1_ITEM_2'],
  itemValues:[vItemValue, vItem2Value]
});

// Example 4 - all options
vUrl = apex.util.makeApplicationUrl({
  appId: 100,                   // default is $v("pFlowId") - current app
  pageId:1,                     // default is $v("pFlowStepId") - current page
  session: $v( "pInstance" ),   // default is $v("pInstance") - current session
  request: 'TEST_REQUEST',      // default is $v("pRequest") - current request
  debug: 'YES',                 // default is $v("pdebug") - debug YES/NO
  itemNames:['P1_ITEM'],        // item names array (no value by default)
  itemValues:[vItemValue],      // item values array (no value by default)
  printerFriendly: 'YES'        // no value by default
});


--------------------- 다른 방법 : 서버스크립트 + 자바스크립트

서버스크립트


begin
  if :P15_SID is not null then
    :P15_REDIRECT_URL := apex_util.prepare_url('f?p=&APP_ID.:Store:&APP_SESSION.::NO:RP,7:P7_SID:'||:P15_SID);
  else
    :P15_REDIRECT_URL := apex_util.prepare_url('f?p=&APP_ID.:Home:&APP_SESSION.::NO:RP::');
  end if;
end;

자바스크립트


apex.navigation.redirect (apex.item("P15_REDIRECT_URL").getValue());


참고

http://apexbyg.blogspot.com/2019/05/generate-apex-url-in-javascript.html


댓글 없음:

댓글 쓰기

20250202 - IG 다운로드 버튼 바로 보이기

JS initialization Code : function (config) {     var $ = apex.jQuery,         toolbarData = $.apex.interactiveGrid.copyDefaultToolbar(),  ...