This article will walk a Maximo administrator through the steps necessary to send a purchase order by email to a vendor as an attachment. It is a common requirement by customers to be able to automatically send the PO to vendors through email. Some of the benefits of doing this are:
Standardize the way that approved purchase orders are communicated to vendors. A common template can be used for the email subject and body, as well as a common workflow for when the communication is sent.
Reduce the time taken by procurement agents in generating reports, saving them locally, finding appropriate contact information, and typing up an email.
When Maximo sends the email, a copy of the email that was sent is stored in the Communication Log along with the PO. If you ever need to know when the email was sent and to whom, the documentation of the email is in Maximo attached directly to the PO. No more searching through email to find the communication.
To achieve this, we will deploy an automation script in Maximo that will generate the report and send the email. Before we get to the script, we need to ensure that the following prerequisites are met:
The email address of the vendor should be recorded in the Companies application on the Contacts tab. The script below will use the email address of the Primary Contact (set on the Addresses tab) but can be adjusted to include a larger or more targeted set of email addresses. However, they must be accessible from somewhere in the system by the script.
A Communication Template should be created and activated to be used as the email subject and body of the communication. By default, I’ve named the template POTOVENDOR, but you can name it anything you want and change it in the script.
A BIRT report that represents the PO to be sent to vendors. By default, the script uses the poprint.rptdesign report that comes with Maximo. This can be changed in the script to a custom report but be sure to match up the report parameters if necessary.
The trigger point for the script below is a status change of the PO to APPR. However, this could just as easily be triggered from Maximo workflow, escalations, or other means.
Here is the automation script needed to make this happen:
from com.ibm.tivoli.maximo.report.birt.queue import ReportQueueService
from com.ibm.tivoli.maximo.report.birt.runtime import ReportParameterData
from psdi.mbo import SqlFormat
# Get the current user's information
userInfo = mbo.getUserInfo()
locale = userInfo.getLocale()
# If the PO Vendor does not have a contact with email, then kindly exit
if not mbo.isNull("VENDOR.PRIMARYCONTACT.EMAIL"):
emailTo = mbo.getString("VENDOR.PRIMARYCONTACT.EMAIL")
# Append the current user's email address to the chain to ensure delivery
if userInfo.getEmail() and not userInfo.getEmail() == "":
emailTo = emailTo + ", " + userInfo.getEmail()
# Create default message subject and body
# These will be replaced by a communication template if one is found by the code below
emailSubject = "Purchase Order"
emailComments = "Please acknowledge receipt of this Purchase Order."
# Change this value to a valid Maximo Communication Template ID
commTemplateID = "POTOVENDOR"
# Get the communication template
commTemplateClause = SqlFormat(mbo, "templateid = :1")
commTemplateClause.setObject(1, "COMMTEMPLATE", "TEMPLATEID", commTemplateID)
commTemplateSet = mbo.getMboSet("$potovendor", "COMMTEMPLATE", commTemplateClause.format())
commTemplateMbo = commTemplateSet.getMbo(0)
if commTemplateMbo:
# Build the email subject and body from the Communication Template
sql = SqlFormat(mbo, commTemplateMbo.getString("SUBJECT"))
sql.setIgnoreUnresolved(True)
emailSubject = sql.resolveContent()
sql = SqlFormat(mbo, commTemplateMbo.getString("MESSAGE"))
sql.setIgnoreUnresolved(True)
emailComments = sql.resolveContent()
# Build the Report Parameters
parameterData = ReportParameterData()
parameterData.addParameter("appname", "PO")
parameterData.addParameter("paramdelimiter", "")
parameterData.addParameter("paramstring", "")
parameterData.addParameter("where", "(po.poid = " + str(mbo.getLong("POID")) + ")")
# Queue the Report to Run
queueManager = ReportQueueService.getQueueService()
queueManager.queueReport("poprint.rptdesign", "PO", userInfo.getUserName(), emailTo, emailSubject, emailComments, parameterData, locale.getCountry(), locale.getLanguage(), locale.getVariant(), userInfo.getTimeZone().getID(), userInfo.getLangCode(), long(0), userInfo)
Alex Walter is the Chief Innovation Officer at the A3J Group, a company he formed to address the need for innovative software solutions and integrated consulting services within the EAM industry. Alex brings 17 plus years of experience in business consulting in various industries including Life Sciences, Oil and Gas, Water and Waste Management, Education, Government Facilities, among others.
Alex lives in Tampa, FL with his wife, two sons, and dogs. In his free time, he enjoys running half marathons, making space in his garage for new camping and outdoor equipment, traveling to far off places with the Walter Circus, and remaining hopeful that his NY Jets' best days are ahead of them and not behind.
7 Thoughts on “Automatically Email Vendor on approval of Purchase Order”
Hi Alex, I am trying to implement this as we have a request for it. Everything appears to work and I see it in the reportrunparam and reportrunqueue tables but nothing ever gets emailed.
Ultimately the email will be sent from the REPORTSCHEDULE cron task, even though it will be queued to run immediately. Make sure that Admin Mode is off and that the cron task is able to run (e.g. check the mxe.crontask.donotrun and mxe.crontask.dorun variables). Also, check the report itself and/or the parameters that you are passing to it. Hope that helps.
Works perfect for me. Great stuff.
A question: Is it possible to open an outlook mail for preview?
Sometime you would need to add or modify the participants list or add special notes
to the template before it’s being send to the vendor.
I have run this script and I can see the email with a report. But , the communication log of PO can’t be created. So, Could you please tell me which part of script is used to create the communication logs?
thanks,
MxApprove End User License Agreement
If you agree to the terms of this MxApprove End User License Agreement (the “License Agreement”), click the Accept License Agreement button after reviewing the contents of this License Agreement to proceed with accessing the MxApprove (the “Application”). IF YOU DO NOT AGREE TO THE TERMS OF THE THIS LICENSE AGREEMENT, YOU WILL NOT HAVE ACCESS TO THE APPLICATION.
This is a license agreement between you, as the licensee and A3J Group LLC, a Delaware limited liability company, (“A3J”), its successors and assigns, its affiliated companies, and its authorized distributors and resellers as the licensor. This is not a contract for sale of the Application, but a license to use the Application subject to the terms and conditions of this License Agreement. Please read the terms carefully. You and A3J agree as follows:
Application.
The Application is the property of A3J. The term Application includes any related documentation, updates and permitted copies of the Application licensed to you by A3J. A3J expressly reserves all rights not expressly granted you.
Scope of License.
Upon your acceptance of the terms contained in this License Agreement, A3J grants you a nonexclusive, nontransferable, limited right to use the Application for personal or business use on the Licensed Devices, as defined below. The term "Use" means to install and access the Application in conjunction with the Application’s related and compatible software.
“Primary Device” shall mean the mobile device, tablet or other device compatible with applications owned or controlled by you, on which you download and install the Application and agree to be bound by the terms of this License Agreement and any other agreement associated with the Application. “Licensed Devices” shall mean the Primary Device and any other device that synchs or otherwise shares the same cloud or backup identification as the Primary Device.
This License Agreement does not allow you to use the Application on any device that you do not own or control. You may not distribute or make the Application available over a network where it could be used by multiple devices at the same time. You may not rent, lease, lend, sell, redistribute or sublicense the Application. You may not assign any right granted under this License Agreement without A3J’s prior written consent. You may not copy the Application. YOU AGREE THAT YOU WILL NOT MODIFY, ADAPT, TRANSLATE, ALTER NOR CREATE DERIVATIVE WORKS OF THE APPLICATION. YOU FURTHER AGREE THAT YOU WILL NOT REVERSE ENGINEER, DECOMPILE, DECRYPT, DISASSEMBLE, NOR SEEK TO DISCOVER THE SOURCE CODE OF THE APPLICATION OR ANY UPDATES ASSOCIATED THEREWITH. IF THE APPLICATION CONTAINS EMBEDDING BITS THAT LIMIT THE CAPABILITIES OF THE APPLICATION, YOU MAY NOT CHANGE OR ALTER THE EMBEDDING BITS.
Embedding of the Application is prohibited. You may NOT otherwise embed the Application. For example and without limitation: (i) You may NOT embed the Application into your hardware, software or other products, such as, application programs, electronic games, e-books, kiosks, printers, etc.; (ii) You may NOT embed the Application into your web pages; and (iii) You may NOT embed the Application into electronic commercial documents. This means that the Application may not be embedded or otherwise used in non-static files that may be accessed by computers or other devices that are NOT Licensed Devices.
A breach of these restrictions may subject you to prosecution and damages, including but not limited equitable relief in the form of an injunction.
Any updates or supplements to the Application will be governed by this License Agreement, unless a separate license agreement accompanies the update or supplement.
Intellectual Property Rights.
The Application, and any trademark, copyrights, patents, or any rights associated with the same, are the intellectual property of A3J. A3J reserves all of its rights under applicable laws. You acknowledge that the structure, organization and code of the Application are valuable trade secrets and confidential information of A3J and you shall not use this proprietary content, information or materials in any way except as expressly permitted under this License Agreement.
No Other Use.
You are granted only the rights expressly stated in this Agreement, and you may not use the Application for any other use or purpose. In addition to other prohibited uses described in this Agreement and without limitation, the following uses are specifically prohibited: (i) You may not share the Application with other individuals or business entities; (ii) You may not use the Application on more than the permitted Licensed Devices; (iii) You may not change the name of the Application; (iv) You may not translate the Application into other platforms.
Consent to Use Data.
A3J may collect and use technical data and related information, including but not limited to technical information about your device, system and application software gathered periodically to facilitate the provision of software updates, product support and other services related to the Application. A3J may use this information, provided this use does not personally identify you, to modify or further develop the Application and/or provide additional technologies to you.
Termination.
The license rights granted under this License Agreement are effective until terminated by you or A3J. Your rights under this License Agreement will terminate automatically without notice from A3J if you fail to comply with any of the term(s) of this License Agreement. Upon termination of the license, you shall cease all use of the Application, and destroy all copies, if any, full or partial, of the Application.
No Warranty.
YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT USE OF THE LICENSED APPLICATION IS AT YOUR SOLE RISK. TO THE EXTENT PERMITTED BY LAW, THE APPLICATION IS PROVIDED “AS-IS” AND “AS AVAILABLE,” WITH ALL FAULTS AND WITHOUT WARRANTY OF ANY KIND. A3J DOES NOT AND CANNOT WARRANT THE PERFORMANCE OR RESULTS YOU MAY OBTAIN BY USING THE APPLICATION. A3J MAKES NO WARRANTIES, CONDITIONS, REPRESENTATIONS OR TERMS, EXPRESS OR IMPLIED, WHETHER BY STATUTE, COMMON LAW, CUSTOM, USAGE OR OTHERWISE AS TO OTHER MATTERS, INCLUDING WITHOUT LIMITATION, NON INFRINGEMENT OF THIRD PARTY RIGHTS, TITLE, INTEGRATION, SATISFACTORY QUALITY, MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. FURTHER, A3J MAKES NO WARRANTIES AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE APPLICATION OR THAT THE APPLICATION WILL MEET YOUR REQUIREMENTS, THAT THE OPERATION AND USE OF THE APPLICATION WILL BE UNINTERRUPTED OR ERROR-FREE OR THAT DEFECTS IN THE APPLICATION WILL BE CORRECTED. IN THE EVENT THE APPLICATION PROVES DEFECTIVE, YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES OR LIMITATIONS PLACED ON STATUTORY RIGHTS, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
Damage Limitations.
TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT SHALL A3J BE LIABLE FOR PERSONAL INJURY, OR ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, LOSS OF DATA, BUSINESS INTERRUPTION OR ANY OTHER COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY TO USE THE APPLICATION, HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT OR OTHERWISE) AND EVEN IF A3J HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall A3J’s cumulative liability for any loss or damage to you (other than as may be required by applicable law in cases involving personal injury) exceed the amount of fifty dollars (US$50.00). The foregoing limitations will apply even if the above-stated remedy fails of its essential purpose.
No Export or Re-Export.
You may not use or otherwise export or “re-export” the Application. Specifically, and without limitation, you may not export or re-export the Application into (a) U.S. embargoed countries or (b) to anyone on the U.S. Treasury Department’s list of Specially Designated Nationals or the U.S. Department of Commerce Denied Person’s List or Entity List. By downloading and installing the Application and agreeing to the terms of this License Agreement you represent and warrant that you are not located in such a country or a person or entity on any such list. You further warrant and represent that you will not use the Application for any purpose prohibited by the laws of the United States.
Governing Law.
This Agreement is governed by the laws of the State of Florida, United States of America, excluding conflict of laws provisions and excluding the United Nations Convention on Contracts for the International Sale of Goods. You expressly agree that any disputes related to this Agreement will be resolved in the Circuit Court of Hillsborough County, Florida, U.S.A., or the United States District Court for the Middle District of Florida, U.S.A. Both you and A3J consent to the personal jurisdiction and venue of those courts. If any part of this Agreement is found void and unenforceable the balance of the Agreement will remain valid and enforceable according to its terms.
This License Agreement represents the entire agreement between you and A3J in connection with its subject matter. This License Agreement may only be modified by A3J in a writing that expressly states that the writing is intended to modify this License Agreement.
Contacting A3J.
A3J has a mailing address of 3225 S. MacDill Avenue, Tampa, Florida 33629, U.S.A. All support requests, completed registrations and other inquiries should be sent via e-mail to info@a3jgroup.com.
Hi Alex, I am trying to implement this as we have a request for it. Everything appears to work and I see it in the reportrunparam and reportrunqueue tables but nothing ever gets emailed.
Ultimately the email will be sent from the REPORTSCHEDULE cron task, even though it will be queued to run immediately. Make sure that Admin Mode is off and that the cron task is able to run (e.g. check the mxe.crontask.donotrun and mxe.crontask.dorun variables). Also, check the report itself and/or the parameters that you are passing to it. Hope that helps.
I’m embarrassed to ask, but some vendors still want to use fax. How do you handle this?
There are some good email-to-fax or text-to-fax services out there. Haven’t tried them myself, but those would likely be your best option.
Hi Alex,
Works perfect for me. Great stuff.
A question: Is it possible to open an outlook mail for preview?
Sometime you would need to add or modify the participants list or add special notes
to the template before it’s being send to the vendor.
Hi Alex,
Is that the entire Automation Script above? I don’t see a vertical scroll bar and the last line I see starts with “queueManager.queueReport(“.
I can see how you’re retrieving the CommTemplate but I don’t see how you’re creating a CommLog or how the report is being attached to the CommLog.
Thanks.
I have run this script and I can see the email with a report. But , the communication log of PO can’t be created. So, Could you please tell me which part of script is used to create the communication logs?
thanks,