Skip to content

Instantly share code, notes, and snippets.

@dzmitryk
Last active August 29, 2015 14:06
Show Gist options
  • Save dzmitryk/36c9d7b03c696e724a17 to your computer and use it in GitHub Desktop.
Save dzmitryk/36c9d7b03c696e724a17 to your computer and use it in GitHub Desktop.
invoice sending script
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()
}
}
@dzmitryk
Copy link
Author

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