Skip to content

Instantly share code, notes, and snippets.

@dzmitryk
Last active August 29, 2015 14:06
Show Gist options
  • Save dzmitryk/ea7bcd9d77b94da83de8 to your computer and use it in GitHub Desktop.
Save dzmitryk/ea7bcd9d77b94da83de8 to your computer and use it in GitHub Desktop.
enrolment sending script
def run(args) {
def enrolment = args.entity
if (enrolment.status == EnrolmentStatus.SUCCESS && enrolment.confirmationStatus == ConfirmationStatus.NOT_SENT) {
def m = Email.create("Enrolment Confirmation")
m.bind(enrolment: enrolment)
m.to(enrolment.student.contact)
m.send()
enrolment.setConfirmationStatus(ConfirmationStatus.SENT)
args.context.commitChanges()
}
}
@ari
Copy link

ari commented Sep 16, 2014

context.localObject(arguments["entity"]) is also very cumbersome. Can't all the objects we already localised in our context?

@dzmitryk
Copy link
Author

Fixed. I've updated the scripts' gists to their current state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment