Sample JPO Method Templates for Notification Attributes

These topiocs provide templates you can use for the JPO:method called by the specified attributes.

See Setting Up Email Notifications with Triggers Example for a procedure to use as a guide.

The following topics are discussed:

Filter Attribute

This section provides sample JPO code that uses filter attributes to determine if a notification should be sent.

 /**
     * This method determines if an email notification should be sent 
or not.
     *
     * @param context the eMatrix <code>Context</code> object
     * @param args contains a packed Map with the following entries:
     *        Id - a String holding the id of an object or relationship
     *        idType - a String that is set to "object" or 
"relationship" (default is "object")
     *        notificationName - a String that is the name of the 
notification object
     *        payload - a Map containing information passed to the 
notification object
     * @return an int 0 if email notification should not be sent
     * @throws Exception if the operation fails
     */
    public static int <method name>(Context context, String[] args) 
throws Exception

From Agent Attribute

This sample code determines the value for the from field of the email message.

/**
     * This method determines which person appears in the "from" field 
of the email message.
     *
     * @param context the eMatrix <code>Context</code> object
     * @param args contains a packed Map with the following entries:
     *        Id - a String holding the id of an object or relationship
     *        idType - a String that is set to "object" or 
"relationship" (default is "object")
     *        notificationName - a String that is the name of the 
notification object
     *        payload - a Map containing information passed to the 
notification object
     * @return a String which is a person
     * @throws Exception if the operation fails
     */
    public static String <method name>(Context context, String[] args) 
throws Exception

Recipient (To, Cc, Bcc) Attributes

This sample code determines the value for the to, cc, and bcc fields of the email message.

/**
     * This method determines which persons appear in the "to", "cc", 
or "bcc" field of the email message.
     *
     * @param context the eMatrix <code>Context</code> object
     * @param args contains a packed Map with the following entries:
     *        Id - a String holding the id of an object or relationship
     *        idType - a String that is set to "object" or 
"relationship" (default is "object")
     *        notificationName - a String that is the name of the 
notification object
     *        payload - a Map containing information passed to the 
notification object
     * @return a StringList which contains recipient users (person, 
group, or role)
     * @throws Exception if the operation fails
     */
    public static StringList <method name>(Context context, String[] 
args) throws Exception

Subject Text Attribute

This sample code determines the value for the subject field of the email message.

/**
     * This method determines what appears in the "subject" field or 
body of the email message.
     *
     * @param context the eMatrix <code>Context</code> object
     * @param args contains a packed Map with the following entries:
     *        Id - a String holding the id of an object or relationship
     *        idType - a String that is set to "object" or 
"relationship" (default is "object")
     *        notificationName - a String that is the name of the 
notification object
     *        objectIdList - a StringList of notification attachments
     *        locale - the Locale of the recipients
     *        bundleName - the base name of the resource property files 
to use for translations
     *        payload - a Map containing information passed to the 
notification object
     * @return a String which is the "subject" field of the message
     * @throws Exception if the operation fails
     */
    public static String <method name>(Context context, String[] args) 
throws Exception

Body Text and Body HTML Attributes

This sample code determines the value for the body of the email message.

/**
     * This method determines what appears in body of the email 
message.
     *
     * @param context the eMatrix <code>Context</code> object
     * @param args contains a packed Map with the following entries:
     *        Id - a String holding the id of an object or relationship
     *        idType - a String that is set to "object" or 
"relationship" (default is "object")
     *        notificationName - a String that is the name of the 
notification object
     *        from - a String that is set to the "from" user
     *        replyTo - a StringList that is set to the "reply-to" field
     *        toList - a StringList of "to" recipients
     *        ccList - a StringList of "cc" recipients
     *        bccList - a StringList of "bcc" recipients
     *        objectIdList - a StringList of notification attachments
     *        locale - the Locale of the recipients
     *        bundleName - the base name of the resource property files 
to use for translations
     *        baseURL - the prefix to use on embedded URL links in the 
message
     *        urlSuffix - the suffix to use on embedded URL links in the 
message
     *        payload - a Map containing information passed to the 
notification object
     * @return a String which is the body of the message
     * @throws Exception if the operation fails
     */
    public static String <method name>(Context context, String[] args) 
throws Exception

Preprocess JPO Attribute

This sample code determines if the email message is sent.

/**
     * This method determines if the email message is sent.
     *
     * @param context the eMatrix <code>Context</code> object
     * @param args contains a packed Map with the following entries:
     *        Id - a String holding the id of an object or relationship
     *        idType - a String that is set to "object" or 
"relationship" (default is "object")
     *        notificationName - a String that is the name of the 
notification object
     *        from - a String that is set to the "from" user
     *        replyTo - a StringList that is set to the "reply-to" field
     *        toList - a StringList of "to" recipients
     *        ccList - a StringList of "cc" recipients
     *        bccList - a StringList of "bcc" recipients
     *        subject - a String that is set to the "subject" field
     *        messageText - a String that is set to the body of the 
message in plain text
     *        messageHTML - a String that is set to the body of the 
message in HTML format
     *        objectIdList - a StringList of notification attachments
     *        payload - a Map containing information passed to the 
notification object
     *        status - a String to hold a return status (any non-empty 
string blocks sending the email)
     * @return Map which should be a copy of the input Map, plus any 
modifications
     * @throws Exception if the operation fails
     */
    public static Map <method name>(Context context, String[] args) 
throws Exception