Auto emailing

Posted:
Thu Mar 17, 2016 3:26 pm
by Atronics
How can I get the email plugins (e.g purchase orders) to fire on the PO Status being changed to Sent?
Re: Auto emailing 

Posted:
Mon Mar 21, 2016 9:34 am
by Scott.Pearce
You can add references to your plugin that refer to some other plugin. This is done via the "Plugin References" tab on Plugin Maintenance. Note, however, that the referenced plugin must be namespaced.
Here's what I did:
1. I created a new plugin called "Email PO Upon Sent".
2. I modified the standard "Purchase Order Custom Email" plugin such that all the classes were wrapped in a namespace called "PurchaseOrderCustomEmail".
3. I also found that I had to change the access modifier of the "EmailPurchaseOrder" function in the "Purchase Order Custom Email" plugin from "Private" to "Public" (so that I could actually access it from the new "Email PO Upon Sent" plugin).
The "Email PO Upon Sent" essentially hooks into some business logic events and keeps track of purchase order status changes. If it finds a purchase order is being saved that has had it's status changed to "Sent", it instantiates a local copy of the "Purchase Order Custom Email" plugin "FormPlugin" class and calls it's "EmailPurchaseOrder" function.
I've attached both the modified "Purchase Order Custom Email" plugin and the new "Email PO Upon Sent" plugin for your perusal.
Re: Auto emailing

Posted:
Tue Mar 29, 2016 3:47 pm
by Atronics
Thanks Scott. That sets me in the right direction.