How to send an Email notification from a Form before submitting it
To send emails (or any other) notification from a form before submitting it, many options are available, but here I'll be explaining how you can achieve this using "Message Events":
Basically, your form will send a "Message Event" via a POST request (More information on Bonita Documentation).
This message will be received by a "Task Listener" that will execute a System task that sends emails to users.
Here are the steps that I have followed to do this:
1) Adding a notification button in the main form
This notification button will send a "Message event" called "NotifyUser" specifying the target Process, target FlowNode, etc.
2) Create a task listener
This task listener will have a message boundary event that will catch the message sent by our form in step 1. It'll receive the CaseId of the Main task as well. This task will have no form (since it would be useless).
3) Create a system task that will send an email notification (to a user for example)
This system task will have a connector that will send a notification email to a certain user (in this example, I used the smtp server and port: localhost:2525).
4) Finally, adding a groovy connector to submit the "task listener" programmatically.
This groovy connector-out will execute the "task listener" since it won't be needed for the rest of the tasks
Note: you can keep it if you want it to catch messages from other tasks of your process.
That's it!!!! You can download from the following link a .bos project (Bonita Community Edition 7.10.4) with all the steps explained above:
I hope my explanation was clear and will be helpful. Please reach out to me in the comments if you have any questions.