How to XOG out attachments for an object
search cancel

How to XOG out attachments for an object

book

Article ID: 27239

calendar_today

Updated On:

Products

Clarity PPM On Premise

Issue/Introduction

We are testing the XML Open Gateway (XOG) interface, and we successfully extracted an incident with attachment. Now we would like to load an incident with some new document attachment. How do we XOG in documents to an Incident object? What is the correct syntax to read out files from an attachment attribute on a custom object?

Environment

Release: ESPCLA99000-13.2-Clarity-Extended Support Plus
Component:

Resolution

The concepts for reading and writing Incident Attachment Documents is the same as for Custom Object Attachment Attributes.  The only difference is for Incidents you use the 'incident_read.xml' sample file and for Custom Objects, you use the 'custom_object_instances_read.xml' sample file and add the arguments in the header.

 

  1. In order to attach a new file to an incident object, use the below structure in the incident_write.xml file . The specified document location should be accessible to both the XOG client and server. It has to be a shared server accessible to both.

    Specify the Version id = -1. When -1 is specified, XOG looks for the file in the location specified in the XOG input file and attaches the file.
    ------------------------ cut ---------------------- 
    
    <ColumnValue name="document"> 
    <Documents> 
    <Parent documentLocation="C:/test"> 
    <Document language="en" mimeType="text/plain" name="DocSample.doc"> 
    <Version id="-1" versionNumber="1"/> 
    </Document> 
    </Parent> 
    </Documents> 
    </ColumnValue>
    ------------------------ cut ---------------------- 
  2. In order to XOG out an incident object with document attached, specify the location or the folder path to export the document to in the arguments section.
    <Header version="13.3.0.286" action="read" objectType="incident" externalSource="NIKU">
       <args name="documentLocation" value="C:\D Drive\DOCXOGTEST"/>
    </Header>
    Note: This is true for an attachment type custom attribute on any object. (see examples below)

Sample XOG XML for Incidents or Custom Objects:

Here is sample incident_write.xml file to XOG IN a document:

<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="../xsd/nikuxog_incident.xsd">
   <Header action="write" externalSource="NIKU" objectType="incident" version="13.3.0.286"/>
   <incidents>
      <incident assignedTo="admin" categoryCode="Test" externalId="12345678-abc-Network" 
      flagForConversion="false" impactCode="3" incidentCode="Exchange lock up1" 
      isPriorityOverriden="false" priorityCode="1" reportedBy="admin" 
       sourceCode="ORACLE-FINANCIAL" statusCode="ASSIGNED" 
       subject="Exchange lock up1" urgencyCode="2">
         <description><![CDATA[Exchange server locked up unexpectedly!!]]></description>
         <notes>
            <note subject="note1"><![CDATA[note1 description]]></note>
         </notes>
         <efforts/>
         <contacts>
            <contact/>
         </contacts>
         <CustomInformation>
            <ColumnValue name="PARTITION_CODE">NIKU.ROOT</ColumnValue>
            <ColumnValue name="document">
               <Documents>
                  <Parent documentLocation="c:\docin">
                     <Document fileCreatedDate="2015-07-21T15:06:55" language="en" 
                      mimeType="text/plain" name="one.txt">
                        <Version id="-1" versionNumber="1"/>
                     </Document>
                  </Parent>
               </Documents>
            </ColumnValue>
         </CustomInformation>
      </incident>
   </incidents>
</NikuDataBus>

Here is sample Incident_read.xml file to XOG OUT document:

<?xml version="1.0" encoding="UTF-8"?> 
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd"> 
<Header version="13.3.0.286" action="read" objectType="incident" externalSource="NIKU"> 
<args name="documentLocation" value="C:\D Drive\DOCXOGTEST"/> 
</Header> 
<Query> 
<Filter name="incidentCode" criteria="EQUALS">Vj</Filter> 
</Query> 
</NikuDataBus>

Note: On Windows server, the document is exported to C:\D Drive\DOCXOGTEST:

For app server on AIX with websphere, the document is exported to the server, but not under the exact folder path specified in the XOG file. Instead, it created the specified folder path under the websphere folder "/usr/IBM/WebSphere/AppServer/profiles/clarity" and exported the document here.

In XOG read file if the documentLocation is set as "niku/xogoutdoc".

The XOG creates the folder (on the application server) as /usr/IBM/WebSphere/AppServer/profiles/clarity/niku/xogoutdoc/Files/140/005/.

 

Here is sample custom_object_instances_read.xml file to XOG IN a document.  Note the added arguments in the header.

<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd"> 
     <Header action="read" externalSource="NIKU" objectType="customObjectInstance" version="13.3"> 
           <args name="documentLocation" value="C:\D Drive\DOCXOGTEST"/> 
</Header> <CustomObjectInstanceQuery> <Filter criteria="EQUALS" name="objectCode">my_custom_object</Filter> <Filter criteria="OR" name="instanceCode">ABC-0001</Filter> </CustomObjectInstanceQuery> </NikuDataBus>