Example: Automating communication by using a custom role

The development team at a large maintenance organization must design a process that notifies people when quantities of certain parts are running low. Unexpected disruptions to the supply chain, for example due to adverse weather or industrial disputes, can affect the availability of parts for scheduled maintenance activities. With advance warning of shortages, work supervisors can reschedule non-essential work that requires these parts, conserving supplies and minimizing the effect on schedules.

About this task

The development team creates a custom role that identifies the users that are to receive notifications. An automation script constructs a mailing list of the email addresses from the person records that have been assigned the custom role and an escalation point specifies the quantity of an item that activates a notification. The escalation record uses a communication template to generate the communication that is sent to users.


  1. In the Roles application, create a custom role and name it, for example MYTESTCUSTOMROLE.
    The name of the role that you create forms part of the name of the automation script you create to automate this process. The name must contain uppercase letters only.
  2. In the Type field, select Custom class and, in the Value field, specify com.ibm.tivoli.maximo.script.ScriptCustomRole.

    This file is a predefined Java™ class that is provided in the Maximo® Manage database.

  3. In the Communications Template application, compose a standard email and, in the Recipients tab, specify the custom role that you created in Step 1.
  4. In the Escalations application, create an escalation to manage the communication flow:
    1. Create an escalation point that specifies the minimum quantity of an item that causes a notification to be sent.
    2. In the Notifications section, specify the role associated with the person group that you created in Step 3.
    3. Activate the escalation.
  5. In the Automation Scripts application, create a simple script based on any standard scripting language. The scripting language in this example is written in Python:
    1. In the Script field, specify MAXROLE.MYTESTCUSTOMROLE.
      The name must be a concatenation of MAXROLE followed by the name of the custom role that you created for this process and must contain uppercase letters only.
    2. Either import a script that you created elsewhere or you can add the script directly into the record. You can use one of the following methods in your script:
    Option Description


    Use this method if you want to select a person or a person group for this role. The ctx variable refers to an instance of the com.ibm.tivoli.maximo.script.ScriptRoleContext Java class. The script can call the ctx.setPersonOrGroupMbo(pergroupmbo) class to set the person or persongroup mbo to this ctx variable, where pergroupmbo is the reference to an existing persongroup mbo.


    Use this method if you want to select a set of emails. The email addresses do not have to be associated with person records. As with the previous option, the ctx variable in the script is associated with an instance of com.ibm.tivoli.maximo.script.ScriptRoleContext Java class. You can use this ctx variable to set email addresses as shown in the following example:

    def evalToEmail(ctx): 
  6. Activate the script and save the record.