AnsweredAssumed Answered

Error XOGing in custom project sub-object using GEL

Question asked by michael.f.brunak on Oct 28, 2010
Latest reply on Oct 29, 2010 by michael.f.brunak
Hello All:

I have the following GEL script which gets triggered within a process whenever a custom "Status" object has an attribute "copy status" checked. The purpose of this process is to avoid the need to manually copy and paste the contents of one instance of a custom object into a new instance. The original instance cannot be modified, but the user wants to copy the status with the only difference being a current datetime stamp.

The script contains a SQL query which is limited to 1 row by including the id from ${gel_objectInstanceId} parameter from the object instance. The query returns 1 row, and invokes the XOG with the values included. The error message is below but indicates that I am not correctly passing the values for the parent object (project) instance. I am passing the odf_parent_id from the original status object. I have confirmed that the instance 5000000 is the correct parent object (project) id.

Any help is much appreciated!

ERROR 2010-10-27 18:42:55,326 [http-81-Processor1] xbl.XOGCustomObjectInstanceHandler (admin:5104571__4482e05a:XOG::customObjectInstance::write) exception XOGging object
com.niku.union.odf.exception.ODFException: Invalid parent object instance 5000000 for object project while importing instance test for object project_snapshot.

GEL:
<gel:script 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:core="jelly:core" xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sql="jelly:sql"
xmlns:xog="http://www.niku.com/xog" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<gel:parameter default="http://rpmpoc:81" var="XOGURL"/>
<gel:parameter default="admin" var="xogusername"/>
<gel:parameter default="RPM!12345" var="xogpassword"/>
 
<gel:setDataSource dbId="niku"/>
<sql:query var="project_query">

select code, name, partition_code, odf_parent_id, odf_cncrt_parent_id, 

created_date, created_by, last_updated_by


from 



(select * from niku.odf_ca_project_snapshot snap2 



where snap2.cp_prj_stat = 1



and snap2.id = ${gel_objectInstanceId}



order by snap2.id desc ) snap
</sql:query>

<core:forEach items="${project_query.rowsByIndex}" trim="true" var="row">

<core:forEach var="field" items="${queryResult.columnNames}" indexVar="i"> 


<core:set value="${row}" var="next_id"/> 

</core:forEach>
</core:forEach>



<soap:invoke endpoint="${XOGURL}/niku/xog" var="result">
<soap:message>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">



<soapenv:Body>
<xog:Login xmlns:xog="${XOGURL}/xog">


<xog:Username>admin</xog:Username>
<xog:Password>RPM!12345</xog:Password>
</xog:Login>





<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">





<Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="12.0"/>






<customObjectInstances objectCode="project_snapshot">







<instance instanceCode="-1" objectCode="project_snapshot" parentInstanceCode="${row[3]}" parentObjectCode="project">








<CustomInformation>









<ColumnValue name="code">AUTO-CODE</ColumnValue>









<ColumnValue name="name">AUTO-NAME</ColumnValue>









<ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>








</CustomInformation>
</instance>
</customObjectInstances>
</NikuDataBus>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
</gel:script>

Outcomes