How to bulk upload images via the Integration Framework?

In the previous post, I provided an example of how we can customise Object Structure to enable import/export of binary data via MIF. It is achieved with Java customisation. From Maximo version 7.6, the automation scripting framework has been greatly extended to support integration. With this update, we can enable import/export of binary data with a simple automation script. Below is an example of how we can configure Maximo 7.6 to bulk upload images to Item Master application:

Step 1: Add a new Object Structure

  • In the Object Structures application, Open and duplicate the MXITEM object structure to create a new one. Name it MXLITEM
  • Under “Source Objects for MXITEM”, delete all child objects, and add a new child object IMGLIB as shown below

Step 2: Add an Integration Automation Script

  • In the Automation Script application, choose Action > Create > Script for Integration
  • In the pop-up, enter the following  details:
    • Select “Object Structure”, choose “MXLITEM” for Object Structure
    • Select “Inbound Processing
    • Language: Python
    • Copy/paste the piece of code below to the  Source Code area.

Step 3: Upload images to Item Master

Download the Excel VBA tool in this GitHub repo. Use it bulk upload images to Item Master:

  • Upload the Settings page with the URL and the username/password to connect to Maximo
  • Put all the image files in the same folder as the Excel file
  • Update the Data sheet with the list of Item Number and the name of the image file.
  • Click on “Upload Images”

Notes & Updates

Note 1: be careful with photos taken from newer cameras, the files usually have high resolution and thus can be quite big. I’ve seen an eager team of engineers upload images for all assets and inventory items in a power plant, and overnight, the database grew from 1GB to 20 GB. Thus make sure you resize the images before uploading.

One quick and simple method in Windows is to select multiple files, then right-click, and choose Send To > Mail Recipient. Windows will give you a pop-up to resize the files, choose the smallest size (640×480). Windows will resize the files, then attach them to Outlook, in Outlook, select all the files, and copy/paste them to a different folder. These files will be much smaller than the original, full-resolution files.

Update Aug/2023: I have posted a new article on how to automatically rescale the image to a smaller size

17 Comments

  1. Unknown

    Yes this is good solution. I have come across a similar requirement but we need to handle this in a user exit those days. Thanks to Automation script for integration nowadays.

  2. Viet Tran

    The best thing about this is we don't have to deploy custom java code. Like for this imglib upload use-case, everything can be done online without server restart or access to the server or database. So that's awesome.

  3. Unknown

    It is a fast-approach solution. I am able to upload bulk images.

  4. PrashantB

    Hi Viet , do you suggest how to get data bean or app bean instance in an automation script with action launch point ?
    can we get client session details ?

  5. dmontoya3

    Hi. In my case the excel works OK but when I go to the item in Maximo the image shows a broken or corrupted image icon (the torn picture icon). If I go to the upload image action I can see the name of the file showing correctly. What am I doing wrong?

  6. drw

    Viet,
    I am trying to use a jython script to change the default image in maximo for an asset to one selected from the attachments for the asset. Here is part of the code (I referred to your code as an example):

    urlName='//maximoattachments.mycompany.org/maximoattachmentstorage/DEV/DOCLINKS/ATTACHMENTS/goldstar.jpg'

    file_object = open(urlName, 'rb')
    all_the_data = file_object.read()

    assetImg.setValue("IMAGE",Base64.decode(all_the_data), MboConstants.NOACCESSCHECK)

    I was expecting a jpg header in the IMGLIG of 0xFFD8FFE1 but it stored 0x13189F30

    Any Ideas?

  7. PabloC

    Nice trick to reduce image size!

    Regards

  8. PrashantB

    Nice article , Viet do you know how to get details from error'ed message from message-traking and manipulate the message using the automation script and process the same to fix error.

  9. Viet Tran

    It is likely that the Automation Script doesn't run, thus, the encoded JPEG data has not been decoded before saving to the table. Could it be Admin Mode is on? Or perhaps Autoscript was created against the wrong Object Structure?

  10. Jack

    Yes is a very good solution to upload images in mass/bulk way.

  11. ashok

    It is working fine & good solution.Thanks for great information.

  12. Prasad_Jarpula

    I have a requirment where i need to download attachments using REST API ..is it possible?

    Please share the solution

  13. Paitoon

    Hi, which folders should we placed the image file?

    Thanks

  14. Something

    Hi Viet,
    This is really a very good solution.
    Do you have similar thing for Asset as well?

  15. Unknown

    Veit,

    What do I need to add to the VBA Script to be able to upload Image to the Asset Record. I am getting a error related to SiteID

  16. Viet Tran

    I don't have it ready available. But you can tweak the same provided example code to upload Imglib for Asset table.

  17. Sayed Saeed

    Great, keep it up

Leave a Reply