Last active
August 29, 2015 14:06
-
-
Save dzmitryk/36c9d7b03c696e724a17 to your computer and use it in GitHub Desktop.
invoice sending script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run(args) { | |
def invoice = args.entity | |
if (invoice.confirmationStatus == ConfirmationStatus.NOT_SENT) { | |
def m = Email.create("Tax Invoice") | |
m.bind(invoice: invoice) | |
m.to(invoice.contact) | |
m.send() | |
invoice.setConfirmationStatus(ConfirmationStatus.SENT) | |
args.context.commitChanges() | |
} | |
} |
Hmm... Did you mean :
def m = Email.create("Tax Invoice")
m.bind(invoice)
If so, this is quite easy to implement if we want to.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now that email templates are bound to a mandatory entity type, perhaps this syntax should instead be: