Maximo Open Forum

 View Only

Adding a Person to Recipient List of Communication Template via Automation Scripting

  • 1.  Adding a Person to Recipient List of Communication Template via Automation Scripting

    Posted 03-03-2023 16:53
    Edited by Toni Fields 03-07-2023 08:43

    Hi! I'm working with 7.6.1, and I'm having a bit of trouble figuring out what's wrong with an automation script that I created that should add a recipient to a communication template. The error that I get from running this script is : 

    [ERROR] [MAXIMO] [] Failed to send messages.
    psdi.util.MXApplicationException: BMXAA3536I - Enter the e-mail address(s) that you want to send this report to.  Separate multiple e-mail addresses with a comma.

    at psdi.common.commlog.CommLog.sendMessage(CommLog.java:235)
    at psdi.common.commtmplt.CommTemplate.sendMessage(CommTemplate.java:499)

    The function that I have for adding the recipient is below:

    def sendComm(s_templateID, s_subject, s_message, s_buyer):
        service.log("*** BUYER: "+s_buyer+" ***")
        service.log("*** BEGINNING OF SENDCOMM METHOD ***")
        commMboSet = mbo.getMboSet("$PRCOMM", "COMMTEMPLATE", "templateid='"+s_templateID+"'")
        commMbo = commMboSet.moveFirst()
        if commMbo is not None:
            commMbo.setValue("SUBJECT", s_subject, MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION)
            commMbo.setValue("MESSAGE", s_message, MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION_AND_NOACTION)
            
            # get buyer's person record and add to commTmpltSendTo table
            personRecMboSet = mbo.getMboSet("$PERSONREC", "PERSON", "PERSONID IN ('"+s_buyer+"', 'MAXADMIN')")
            personRecMbo = personRecMboSet.moveFirst()

           if personRecMbo is not None:
                commMbo.addPersonRecipients(personRecMboSet)
                commMbo.updateRecipientList("sendto")

            commMboSet.save()

            commMbo.sendMessage(mbo, mbo)


         commMboSet.clear()
         commMboSet.close()
         return

    Can someone help me figure out what I am missing? Thanks in advance.


    #Customizations
    #EverythingMaximo

    ------------------------------
    Toni Fields
    Thiele Kaolin
    ------------------------------