Example Post-Job Scriptlet

This example illustrates a Post-job scriptlet that will send email to the members of the role specified in the scriptlet call.

Astoria provides a review sequence scriptlet named sendEmailToRoleGroup that can be specified in a Task Sequence document Post-job Scriptlet field for a job transition.

Most likely, your organization would not call this script directly, but rather call your own script, which filters when to call this script. For example, if you are changing status on a map and have specified in the application document that Set workflow status on referenced documents is enabled, the scriptlet would be called not just for the map, but all referenced topics. Here is an example:

def sendSomerEmailToRole(database, moduleH, job, object, currentStatus, nextStatus, isPre, roleName, subjectKey, bodyKey):
 objectFlavor = object.GetFlavor(database)
 if "dita_map_bookmap" != objectFlavor:
  return
 starScriptlets.sendEmailToRoleGroup(database, moduleH, job, object, currentStatus, nextStatus, isPre, roleName, subjectKey, bodyKey)

#######################################################################################################################
#
# job review scriptlet registration
#
#######################################################################################################################
registration.registerTaskSequenceScriptlet(sendSomeEmailToRole)

Here is an example of the entry in the Post-job Scriptlet field of a Task Sequence document for the job transition:

sendSomeEmailToRole("Reviewer", "testSubject", "testBody") #Reviewer is the name of the Role whose active members should receive the email

The scriptlet supports a number of parameters that can be specified in the email subject or body message keys to generate dynamic content:
Type Value
job Id 0
ticket name 1
ticket view URL 2
ticket flavor 3
due date 4
reference name 5
reference view URL 6
reference flavor 7
new owner 8
status changer 9
next status 10
comment 11
envelope ticket name 12
envelope ticket view URL 13
envelope ticket remaining count 14
reference type descriptor 15
envelope ticket id 16
list of changed topics 17
list of topics that weren't changed 18