Tuesday, April 11, 2017

Auto-dismiss APEX Universal theme success messages

In the APEX 5.1.1 Universal Theme demonstration application, a code snippet is included showing how to automatically dismiss Success messages via JavaScript using the apex.theme42.configureSuccessMessages API.
Trouble is it only works in some circumstances, as can be seen in screenshot from a demonstration application below.


You can try the demo application to observe the issue, and a solution that works right now. You can download the application, which probably works on earlier versions of the Universal theme - I haven't tested it.

6 comments:

Stew said...

For those of us who can't upgrade to 5.1.1 in the near future, is there any chance this snippet could be applied to existing applications in, say version 5.0.4?
Or does someone have an add-on script that would implement this?

TIA,

Stew

michael.b said...

@Stew: I created a dynamic action to do that in Apex 5.0
Event: Page Load
Action: Execute JavaScript Code
Code:
$('div#t_Alert_Success').closest('div.t-Body-alert').delay(4000).fadeOut();

To auto-dismiss not only success messages but the error message region as well you can use
$('div.t-Body-alert').delay(4000).fadeOut();

Pradeep Singh said...
This comment has been removed by a blog administrator.
Unknown said...
This comment has been removed by a blog administrator.
Unknown said...

The Close Success Message Button (X) isn't working anymore?
When clicking the Button the Success Msesage won't hide.

Koloo said...

Hi,
did anyone manage to resolve this in Apex 5.2? it seems all suggestions here are not working at all...thanks