IVK_SendOrderCompletedEmail
- Following general naming conventions this microflow should be named something closer to 'ACT_Orders_SendOrderCompletedEmail'
- The first retrieve in this microflow should use square brackets for separation rather than 'and'. So something more like [Status = 'Delivered' or Status = 'Completed'][CompletedEmailSent = false()]
- There shouldn't be a commit or refresh within the loop, this should be done after the loop has completed and should be done on the list rather than each individual object within that list
- When calling the SUB_SendOrderCompletedEmail microflow you should pass the list of orders as a parameter rather than performing the same retrieve action again
SUB_SendOrderCompletedEmail
- Again with the naming conventions, this microflow name should represent the main entity being worked on, so it should be something more like SUB_Email_SendOrderCompletedEmail
- The retrieve should be replaced with an incoming parameter from the calling microflow to /slightly/ increase performance and reduce unnecessary redundancy
- We should do a single retrieve here before the loop on all emails, and then perform a 'List Operation - Find' on the retrieved list of email objects to find a specific email through it's association with the IteratorOrder
- Instead of committing the new email object within the loop it should be added to the retrieved list, and the retrieved list should be committed at the end of the microflow.
- This is more a preference than best practices, but the branches of the decision should be uniform for readabilitiy's sake. In this case the false branch should be pointing down because that was the convention established in the calling microflow.
General Notes
- Finally, again this is more of a preference than best practices, but it would be nice to include some kind of message to let the user know the process completed. Maybe even include how many emails were supposedly sent off in the message?
- I appreciate the annotation. It's the sign of a empathetic developer, and that's awesome.
Ok, here are my two cents about these microflows:
First of all, I'm not commenting on the naming convention. This depends on whether the functionality should be performed automatically for the relevant orders, or be a manual function for a user to invoke on a selection of orders from, for example, a data grid. This is not specified.
Second of all, the most obvious, single action activity issues:
These are all single action remarks. My peer review would go further (although it might not all have to do with best practices):
1. Create list widget once created app in Mendix.
2. Add Entity in Domain Model to get the list of all the order status
3. If Order Status is delivered then Call Microflow (IVK_SendOrderCompletedEmail) to send email and set CompletedEmailSent = false.
4. If Order Status is completed then Call Microflow (IVK_SendOrderCompletedEmail) to send email and set CompletedEmailSent = true.
4. Create another Microflow (SUB_SendOrderCompletedEmail) and get the list of Order which completed and CompletedEmailSent = true
then create email if email is an empty and call SUB_Sendemail to send email.
For the IVK flow:
For the SUB flow:
Reconstruct the second microlfow by following below points :
Reconstructing the second microflow eliminates Additional loop and Additional retrieve activity.
Reconstruct the first microflow by following below points: