MxLoader

 View Only
Expand all | Collapse all

Upload Image to IMGLIB for ITEM.

  • 1.  Upload Image to IMGLIB for ITEM.

    Posted 05-09-2023 05:52
    Edited by Manuel Guyot 05-09-2023 06:02

    Hi,

    I am using MxLoader 8.2 with Maximo 7.6.1.2 and try to upload picture connected to ITEM. 
    This is my MxLoader:

    MXL_ITEMPIC ITEM AddChange itemnum="19351"        
    ITEMNUM ITEMSETID DESCRIPTION STATUS IMGLIB.IMAGE IMGLIB.IMAGENAME IMGLIB.MIMETYPE [RESULT]
    19351 ISSE VENTIL FESTO JH-5-1/2 ACTIVE FileEnc:/C:\Temp\Reservdelar\10165.jpg 10165.jpg image/jpeg OK


    I can see that the picture is uploaded to Maximo with the right information but the picture is "broken", I can't see it or open it.


    I have started the Debug mode in MxLoader and copied the information saved into IMGLIB/IMAGE, pasted it in a Base64 decoder and the picture is the same than the one I uploaded, so what did I do wrong?

    Anyone who succeed in uploading picture to ITEM with MxLoader?

    Thanks.



    ------------------------------
    Manuel Guyot
    Husqvarna AB
    ------------------------------



  • 2.  RE: Upload Image to IMGLIB for ITEM.

    Posted 06-29-2023 01:06
    After some test and research, I found what was missing.
    I had to create a script for integration connected to MXITEM like this:
    from org.apache.axiom.om.util import Base64
     
    def afterMboData(ctx): 
     if ctx.getMboName()=='IMGLIB': 
      ctx.getMbo().setValue("IMAGE",Base64.decode(ctx.getData().getCurrentData("IMAGE")))
    And had to add IMGLIB to object MXITEM.
     
    Then it was working without any problem.



    ------------------------------
    Manuel Guyot
    Husqvarna AB
    ------------------------------



  • 3.  RE: Upload Image to IMGLIB for ITEM.

    Posted 03-06-2024 00:22

    Hi, I tried this method and getting below error:

    Internal Server Error
    Error 500: BMXAA4211E - Database error number 2601 has occurred when operating on IMGLIB :  Unique Id=12,233. Report the error to the owner of the deployment.

    I created integration script for MXITEM with your code for inbound processing. In MXLOADER I've tried two different object structures, MXITEM adn MXLITEM (created new) but getting the same error. 

    I'd really appreciate if you can provide your insights.

    Cheers

    Hammad



    ------------------------------
    Hammad Najeeb Ghumman
    Keolis Downer
    ------------------------------



  • 4.  RE: Upload Image to IMGLIB for ITEM.

    Posted 06-19-2024 03:36

    Hi, for me it worked using MxLoader Sync Action .

    Regards, Janez



    ------------------------------
    Janez Naglic
    KOPA d.d.
    ------------------------------



  • 5.  RE: Upload Image to IMGLIB for ITEM.

    Posted 12-01-2025 03:14

    Hi,

    With Maximo MAS, things changes and when you try to send a picture you get the message: "Upload of bynary files is not yet supported for REST APIs." (Message from MxLoader), for those who are creating own VBA scripts, this can be done by easy way:

    In my script I write in the IMGLIB.IMAGE column the referens to the file like:

    Picture:/D:\Temp\JPG\Image.jpg

    Then in my script I detect the "Picture:/" and then send the encryption like:

    PictureB64 = Chr(34) & "image" & Chr(34) & ": " & Chr(34) & EncodeFileToBase64(Right(value, Len(value) - 9)) & Chr(34)

    The Function is:

    Public Function EncodeFileToBase64(filePath As String) As String
        Dim fileStream As Object
        Dim xmlObj As Object
        Dim fileBytes() As Byte

        ' Read file as binary
        Set fileStream = CreateObject("ADODB.Stream")
        fileStream.Type = 1 ' Binary
        fileStream.Open
        fileStream.LoadFromFile filePath
        fileStream.Position = 0
        fileBytes = fileStream.Read
        fileStream.Close

        ' Convert to Base64
        Set xmlObj = CreateObject("MSXML2.DOMDocument").createElement("b64")
        xmlObj.DataType = "bin.base64"
        xmlObj.nodeTypedValue = fileBytes
        EncodeFileToBase64 = xmlObj.Text
    End Function

    I don't know if it can help someone but I put it here so that it can give some hints or help on the way, I got it working perfectly with my script.



    ------------------------------
    Manuel Guyot
    Husqvarna AB
    ------------------------------



  • 6.  RE: Upload Image to IMGLIB for ITEM.

    Posted 3 days ago

    I need support with the steps how to utlize the above mentioned script in MXloader, I am also trying to load item records with images and getting message: "Upload of bynary files is not yet supported for REST APIs." Please guide with the steps



    ------------------------------
    Arshiya Sultana
    TCS
    ------------------------------



  • 7.  RE: Upload Image to IMGLIB for ITEM.

    Posted yesterday

    I was able to upload without the script. This is what I did

    1. Create a new OS by duplicating the OOB MXITEM OS
    2. Keep only ITEM and IMGLIB as the objects in the OS
    3. Under the More Actions select the Configure Object Structure security
    4. Check the "Use Object Structure for Authorization Name"
    5. Go to the Security Group of the user which will be used to upload the images and under the Object Structure tab provide access to the above newly created OS
    6. In the MxLoader Config tab, I used the service as OS and Authentication as API
    7. Used the below in the MXLoader Sheet
    8. image
    9. I was able to upload the image by following the above steps



    ------------------------------
    Priyaranjandas Kolambkar
    COSOL Global
    ------------------------------



  • 8.  RE: Upload Image to IMGLIB for ITEM.

    Posted yesterday
    We're on MAS 9. When we use OS as the service and use API for authentication, we get the error: 'API authentication is only supported for REST service.


    ------------------------------
    Arshiya Sultana
    TCS
    ------------------------------



  • 9.  RE: Upload Image to IMGLIB for ITEM.

    Posted 23 hours ago

    It worked for us on MAS 9 too.



    ------------------------------
    Priyaranjandas Kolambkar
    COSOL Global
    ------------------------------



  • 10.  RE: Upload Image to IMGLIB for ITEM.

    Posted 22 hours ago
      |   view attached

    I have attached  config details from Mxloader, anything needs to corrected?



    ------------------------------
    Arshiya Sultana
    TCS
    ------------------------------



  • 11.  RE: Upload Image to IMGLIB for ITEM.

    Posted 17 hours ago

    You might need to check the URL in your config sheet. If the Manage URL is of the format https://<workspace_id>.manage.<mas_domain>/maximo - then in MxLoader, the URL should be https://<workspace_id>.manage.<mas_domain> (without the /maximo at the end)



    ------------------------------
    Priyaranjandas Kolambkar
    COSOL Global
    ------------------------------