Close page & display message not working until Microflow completed

Hi all,  Here is section of a microflow which is triggered when the user clicks "i forgot my password" Once the button has been clicked an email is sent to the admin to say someone has requested a password reset. However the email takes up to 20 seconds to send, which is a long time with nothing on the user's screen, so they will end up clicking again to see if something happens which will mean the microflow will be triggered again. I changed the microflow so it closes the page, displays the message and then sends the email. This however does not happen, the microflow is still waiting for the send email subflow to be completed before closing the page and displaying a message.  Is this how it is supposed to work, and does anyone have any suggestions?
2 answers

Hi Garion,

You should do the email sending asynhronously. You can use the java action "executeMicroflowInBackground " from community commons for example. This java action returns immediately so the users gets feedback and the actual email sending will be done in a separate thread.



Microflows are executed once the end event is reached (the transaction finishes) . You could send your email via the processqueue, or use a nanoflow, which will execute client-side actions instantly, although they are a bit limited at the moment.