IBM Support

How to import attachments into MAXIMO using MIF

Technical Blog Post


Abstract

How to import attachments into MAXIMO using MIF

Body

In this blog I will explain the most common option to upload attachments into Maximo 7.6.
The file is uploaded to the Maximo Server where doclinks configuration points to.

First thing to check is if your Maximo environment is setup to use attachments. If you have further questions about it, please check the technote below “How to set up attached documents with Websphere Application Server”:

/support/pages/node/100981

 

How to upload file using MIF (Maximo Integration Framework)?

There are several ways to import data into Maximo, REST, Web Services, Flat files, etc.

I will be using a Web Service in this example, but the Object Structure/Metadata will be the same for every possibility.

 

  1. Create Object Structure.

You have two scenarios:

  1. Send only the attachment using table DOCLINKS.
  2. Send the attachment owner with DOCLINKS table, like WORKORDER,SR, ITEM, etc. To know if the desired table is supported, a tip is execute query below:

select parent from maxrelationship where child = 'DOCLINKS';

In this example I am using SR(Service Request) table with DOCLINKS as below:

image

 

Observation: You can also create an Enterprise Service, but in this example we will use only Object Structure.
 

  1. Create Web Service.

I am not going to enter in every detail of Web Service creation. You just need to create and deploy Web Service. You can do that using Web Services Library application.

image

 

 

  1. Submit the XML.

You can use any tool to submit XML into Web Service. I usually use SoapUI, it’s simple and easy to use.

https://www.soapui.org/
 

The XML below is just a sample having the required attributes.

XML:

  1. Scenario 01: In this scenario you are going to upload the file to the server into doclinks folder. (In my case C:\doclinks\attachments)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:max="http://www.ibm.com/maximo"&gt;
   <soapenv:Header/>
   <soapenv:Body>
      <max:SyncMXDOCLINK>
         <max:MXDOCLINKSet>
              <max:SR action="AddChange">
               <max:DESCRIPTION >Test 01 SR description</max:DESCRIPTION>
                <max:ORGID>EAGLENA</max:ORGID>
                <max:SITEID>BEDFORD</max:SITEID>

                 <max:DOCLINKS>
                  <max:ADDINFO>1</max:ADDINFO>
                  <max:COPYLINKTOWO>0</max:COPYLINKTOWO>
                  <max:DESCRIPTION>Example of Attach </max:DESCRIPTION>
                  <max:DOCTYPE>Attachments</max:DOCTYPE>
                  <max:DOCUMENT>Test 01</max:DOCUMENT>
                  <max:DOCUMENTDATA>MTIzMTMyMzE=</max:DOCUMENTDATA>
                  <max:OWNERTABLE>SR</max:OWNERTABLE>
                  <max:UPLOAD>1</max:UPLOAD>
                  <max:URLNAME>C:\DOCLINKS\ATTACHMENTS\testfile01.txt</max:URLNAME>
                  <max:URLTYPE>FILE</max:URLTYPE>
               </max:DOCLINKS>

            </max:SR>
         </max:MXDOCLINKSet>
      </max:SyncMXDOCLINK>
   </soapenv:Body>
</soapenv:Envelope>

 

Observations:

DOCUMENTDATA: This is the file by itself. But the file must be encoded in base64.
Use this site as example: http://www.motobit.com/util/base64-decoder-encoder.asp

OWNERID: This is a required field, but in this case is not necessary because the relationship will fill in the value for you. But if you create an Object Structure with DOCLINKS only, you must send this value. DOCLINKS table will always have an owner table. OWNERID is the ID of the owner table, for example, if the owner table is WORKORDER owner ID is WORKORDERID.

URLNAME: Maximo will not create the file in the repository with the name sent (testfile01.txt). To avoid duplicity Maximo will merge that name with an ID. In this example the file created was testfile011517326203961.txt.

 

SR:image

 

 

  1. Scenario 02: In this scenario you are NOT going to upload the file to the server using MIF. In this scenario you must manually paste the file into doclinks folder in Maximo server. MIF will only create the record into DOCLINKS and DOCINFO tables.

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:max="http://www.ibm.com/maximo"&gt;
   <soapenv:Header/>
   <soapenv:Body>
      <max:SyncMXDOCLINK>
         <max:MXDOCLINKSet>
              <max:SR action="AddChange">
               <max:DESCRIPTION >Test 02 SR description</max:DESCRIPTION>
                <max:ORGID>EAGLENA</max:ORGID>
                <max:SITEID>BEDFORD</max:SITEID>

                 <max:DOCLINKS>
                  <max:ADDINFO>1</max:ADDINFO>
                  <max:COPYLINKTOWO>0</max:COPYLINKTOWO>
                  <max:DESCRIPTION>Example of Attach 02</max:DESCRIPTION>
                  <max:DOCTYPE>Attachments</max:DOCTYPE>
                  <max:DOCUMENT>Test 02</max:DOCUMENT>
                  <max:OWNERTABLE>SR</max:OWNERTABLE>
                  <max:UPLOAD>0</max:UPLOAD>
                  <max:URLNAME>C:\DOCLINKS\ATTACHMENTS\testPF.txt</max:URLNAME>
                  <max:URLTYPE>FILE</max:URLTYPE>
               </max:DOCLINKS>

            </max:SR>
         </max:MXDOCLINKSet>
      </max:SyncMXDOCLINK>
   </soapenv:Body>
</soapenv:Envelope>

 

Observations:

URLNAME: Upper case/Lower case matters for this scenario. Be sure that you are sending in the same format that your server. In this scenario Maximo will not change the name of the file (testPF.txt) you must guarantee the uniqueness of the file name in the desired folder.

DOCUMENTDATA: We are not sending this field because we are not uploading the file in this scenario.

UPLOAD: We changed the value of this field to 0 to indicate that we are not uploading the file.

 

SR:image

 

 

Stay tuned for more.

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSLKT6","label":"IBM Maximo Asset Management"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

UID

ibm11129389