I'm currently using Oracle APEX version 24.2.1 and working with APEX Tasks to send notifications that include a link to the task detail page.
Every task is created from a workflow.
(Approval/Reject)
l_url := apex_util.host_url || apex_util.prepare_url(
p_url => 'f?p=1000:1::::1:'
, p_checksum_type => 'PUBLIC_BOOKMARK'
, p_plain_url => true
);
(Create)
l_url := apex_util.prepare_url(
p_url => 'f?p=1000:1::::1:'
, p_checksum_type => 'PUBLIC_BOOKMARK'
, p_plain_url => true
);
Here’s the issue I encountered:
-
When I use apex_util.prepare_url alone in the "Create" event, the returned URL includes the full host, for example:
https://example.com/ords/r/f?p=123:456:::NO::P456_ID:100
-
But when I use the same **apex_util.prepare_url** alone in the "Approval" or "Reject" events, the returned URL does not include the host, and I only get the relative path, like:
/ords/r/f?p=123:456:::NO::P456_ID:100
-
If I try to use apex_util.host_url || apex_util.prepare_url(...) in the “Create” the result URL includes a duplicate protocol, like:
http://https://example.com/ords/r/f?p=1000:1::::1:
As a result, I have to handle them differently:
- For "Create" event →
apex_util.prepare_url alone is fine
- For "Approval"/"Reject" events → I have to use
apex_util.host_url || apex_util.prepare_url(...) to get the full URL with host
My questions are:
- Why does the behavior of
apex_util.prepare_url differ between the "Create" event and the "Approval"/"Reject" events?
- Is there a recommended or consistent approach to ensure the full URL (with host) is always returned regardless of the event?
Thank you for your help!