Generating messages

Use method createMessage to create the message text, which can be either a simple text message or a more involved constructed message. The following code is an example of a simple text message that uses the Gosu in-line dynamic template functionality to construct the message. Gosu in-line dynamic templates combine static text with values from variables or other calculations that Gosu evaluates at run time. For example, the following createMessage method call creates a message that lists the event name and the entity that triggered this rule set.
  • messageContext.createMessage("${messageContext.EventName} - ${messageContext.Root}")

The following is an example of a constructed message that provides more detailed information if an external submission batch completes successfully.

var batch = messageContext.Root as SubmissionGroup
var subs = batch.Submissions
 
var payload : String
payload = "External Submission Batch "
payload = payload + "(" + batch.Submissions.length + " Submissions):"
 
for (sub in subs) {
  payload = payload + " " + sub.JobNumber
}
 
messageContext.createMessage(payload)