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?
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.
------------------------ 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 ----------------------
<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>