Hi there! Use case: in the app, users are able to send a request using a form. The manager can then accept or reject the request. Problem: When the manager clicks on ‘reject’, I want the possibility to send an e-mail to the requester. The manager should be able to add a message to the e-mail before sending. I currently have the e-mail template module. I have the following microflow: How can I make the template visable, so the manager can enter a text before sending it to the requester?
So on your page, there will be a reject button. Behind the reject button, make a custom nanoflow that does the following:
Retrieve the email template
Use a flow that's similar to the “Sub_CreateAndSendEmail” flow, but remove the part where it's actually sent or committed. This way you will only make the e-mail without sending it.
Set the newly created e-mail as the return value of the subflow
In your nanoflow, open a page where you show the newly created e-mail including the “htmlbody” or “plainbody” field (depending on your use case) of the e-mail. Your user can now edit the content field
Put a button on the page for the user to send the e-mail. Add a microflow behind this button that copies the htmlbody text or plainbody text to the other field in the appropriate format, commits the e-mail and any attachments, sets the status of the request to rejected, and calls the IVK_SendMail microflow. After that you can close the page or go to whatever page you like.
Make a page where the request can be approved or denied (according to your use case, of course, this is just an example). Add a flow for each button.
Create a 1-1 association between your “Request” entity and the “Email” entity. This way we can track which e-mail belongs to the request
Copy the flow “Sub_CreateAndSendEmail” to your own module and rename it to “Sub_CreateEmail" (because we're not going to send it yet).
Open the copied flow. We're going to make a few changes here:
Remove any microflow parameters you don't need, like “Order” and “Customer”. Add a new parameter called “Request”
Remove both of the commits. We're not going to save anything yet until the approver enters the text for the e-mail
In the “set email data based on the customer and template”, make set the association between email and request.
Remove the “IVK_SendEmail” part (the last block in the flow). You now have a flow that create the email for you according to the template, but doesn't send the e-mail yet (and doesn't commit it to the database yet)
Set the “NewEmail” as the return value of your microflow:
Open the flow that you used for the “approve button”. Use a microflow call to call your newly created microflow. Then, add a show page action that shows the page where your manager can add the e-mail content. Be sure to pass the Email object to the page:
The page you created should automatically have all the Email fields on it. You will only leave the fields here that you want the user to fill out. If you have already preset everything except the content in your e-mail template, then just show the “plaintext” field
Add a microflow call behind the “send mail” button. In this microflow, we will do 4 things:
Set the status of the request to rejected (and commit)
Commit the newly created any attachments that are attached to the email (the email itself will be committed in the next step)
Send the e-mail with the IVK_SendMail flow that's standard in the e-mail module
Go back to whichever page you want the user to go to