A workflow that sends an e-mail with an overview of non-invoiced sales orders - Printable Version +- CoreBOSBB (https://discussions.corebos.org) +-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18) +--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4) +--- Thread: A workflow that sends an e-mail with an overview of non-invoiced sales orders (/showthread.php?tid=413) |
A workflow that sends an e-mail with an overview of non-invoiced sales orders - Guido1982 - 09-09-2016 Take a look at this repo: https://github.com/Luke1982/sendEmailNotInvoicedSOs It's quite rudamentary, but does the job I needed it to do. The idea: create a workflow for sales orders that gets all the salesorders with a 'Delivered' state and that are not 'deleted', of which the duedate is in the past. Then collect all invoices made for this sales order and see it the totally invoices amount is at least the sales order amount. For each sales order that has not been completely invoiced a row in a table is made. That table is sent to an e-mail address (or multiple, comma separated) and sent these addresses. At the bottom of the table is the sum of all non-invoiced amounts. I set this as a scheduled workflow, so an administrator could get a daily, or weekly overview of the sales orders that have not been completely invoiced. In the workflow config screen there is an option to limit the years the workflow looks back in time, related to the duedate of the sales order. From the table in the e-mail, you can go directly to the sales order in the CRM. Now we could expand on this:
Woops, found out that even if you schedule a workflow and do nothing with the entity, the workflow does get executed for EVERY sales order.... I just received 1000 e-mails... RE: A workflow that sends an e-mail with an overview of non-invoiced sales orders - Guido1982 - 09-09-2016 I've now re-built this as a cronjob. This works OK, but doesn't have the benefits of setting anything through any config panel... |