Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A workflow that sends an e-mail with an overview of non-invoiced sales orders
#1
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:
  • Create 'assigned user' or just a 'users' dropdown to dynamically pick the 'send to' e-mail.
  • The table heads are now all in dutch hard-coded. These could come from a language file.
  • The e-mail subject could be set in the config screen.
  • There is currently no check to see if the CRM uses HTTPS.
  • There is no currency symbol

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...
Reply
#2
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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)