I've created a region, let's call it Notifications
with Static ID: P1_NOTIFICATIONS
, set its Template
to Inline Dialog
and added a sub-region called row-01
without any Static ID
.
row-01
has a button OK
with P1_MODAL_OK
ID and the following Behavior
: Action: Redirect to URL
, Target: javascript:apex.navigation.modal.close(true,["P1_NOTIFICATIONS"])
or Target: javascript:apex.navigation.modal.close(true)
.
Neither JS API calls seem to work, modal doesn't close on clicking my button.
Tried also a dynamic action to Hide
the P1_NOTIFICATIONS
region, but it only hides its content, doesn't close the modal itself with all the overlays and stuff. The header and empty body are still visible.
Also there's an [x] Close
button in the header, but I need to hide it. I also can't find its action, the script it calls to close the modal inline dialog region.
How to close the modal from my P1_MODAL_OK
custom button? And how to catch the action triggered by the [x]
button from modals header?
EDIT 1: openModal('P1_NOTIFICATIONS')
works as well as closeModal('P1_NOTIFICATIONS')
. The second solves my problem.
Update 2024
I no longer use APEX nor I follow this tools updates. This solution could've been made obsolete. Feel free to post Q&As for newer versions in a new thread.
I've created a region, let's call it Notifications
with Static ID: P1_NOTIFICATIONS
, set its Template
to Inline Dialog
and added a sub-region called row-01
without any Static ID
.
row-01
has a button OK
with P1_MODAL_OK
ID and the following Behavior
: Action: Redirect to URL
, Target: javascript:apex.navigation.modal.close(true,["P1_NOTIFICATIONS"])
or Target: javascript:apex.navigation.modal.close(true)
.
Neither JS API calls seem to work, modal doesn't close on clicking my button.
Tried also a dynamic action to Hide
the P1_NOTIFICATIONS
region, but it only hides its content, doesn't close the modal itself with all the overlays and stuff. The header and empty body are still visible.
Also there's an [x] Close
button in the header, but I need to hide it. I also can't find its action, the script it calls to close the modal inline dialog region.
How to close the modal from my P1_MODAL_OK
custom button? And how to catch the action triggered by the [x]
button from modals header?
EDIT 1: openModal('P1_NOTIFICATIONS')
works as well as closeModal('P1_NOTIFICATIONS')
. The second solves my problem.
Update 2024
I no longer use APEX nor I follow this tools updates. This solution could've been made obsolete. Feel free to post Q&As for newer versions in a new thread.
Share Improve this question edited May 25, 2024 at 15:23 tsilvs asked Jul 2, 2018 at 14:25 tsilvstsilvs 4646 silver badges27 bronze badges 4- 1 Did you try 'Close Dialog' Dynamic action on the button? – Blurryface Commented Jul 2, 2018 at 18:09
- @Blurryface yeah, thanks. Couldn't find it for the first time for some reason. Also there is no mention on the internet for that method. – tsilvs Commented Jul 3, 2018 at 5:27
- @Blurryface But it doesn't work. – tsilvs Commented Jul 3, 2018 at 5:27
- I encourage people who read this to switch to open source solutions or even try coding. It's not that hard when you learn basics of HTML & CSS do make UIs. – tsilvs Commented May 21, 2024 at 21:23
3 Answers
Reset to default 3To close modal inline dialog
region, create a Redirect to URL
button with the following call in target: javascript:closeModal('P1_NOTIFICATIONS')
, where P1_NOTIFICATIONS
is region's Static ID
.
What worked for me, i Created a dynamic action on the button with the action Close Region and then under affected element i selected the region for the inline dialog
Bellow code worked for me.
javascript:apex.navigation.dialog.close(true);
maybe this is the action for [x] Close
of apex.