AnsweredAssumed Answered

XOG in Custom Object Instance - Lookup Error

Question asked by Owen_R on Nov 24, 2010
Latest reply on Aug 8, 2012 by baburaj
I'm building up a script to create new instances of a project sub-object (v12.06). Before I start putting in dynamic processing I'm starting with a simple single write call with hard coded values as per the script below:
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
    <Header action="write" externalSource="NIKU"
        objectType="customObjectInstance" 


overrideAutoNumbering ="false" version="12.0.6.5471"/>
    <customObjectInstances objectCode="axa_nrr">
        <instance instanceCode="-1" objectCode="axa_nrr"
            parentInstanceCode="82056" parentObjectCode="project">
            <CustomInformation>
                <ColumnValue name="actual_quantity">100</ColumnValue>
                <ColumnValue name="actuals_date">2010-11-22T00:00:00</ColumnValue>
                <ColumnValue name="code">""</ColumnValue>
                <ColumnValue name="odf_cncrt_parent_id">5022937</ColumnValue>
                <ColumnValue name="odf_parent_id">5022937</ColumnValue>
                <ColumnValue name="partition_code">NIKU.ROOT</ColumnValue>
                <ColumnValue name="task_id">5172986</ColumnValue>
                [color=#FF0825]<ColumnValue name="resource_id">5008860</ColumnValue>[/color]               
<ColumnValue name="status">1</ColumnValue>
            </CustomInformation>
            <OBSAssocs completed="false"/>
                    </instance>
    </customObjectInstances>
    <XOGOutput>
        <Object type="customObjectInstance"/>
        <Status state="SUCCESS"/>
        <Statistics failureRecords="0" insertedRecords="0"
            totalNumberOfRecords="1" updatedRecords="0"/>
        <Records/>
    </XOGOutput>
</NikuDataBus>
My problem is that this will error out with the following message if I leave the Resource_ID entry in
ErrorInformation>
                <Severity>FATAL</Severity>
                <Description>com.niku.union.odf.exception.ODFValidationException: Validation failure. Attribute: resource_id. Cause: lookup_value</Description>
            </ErrorInformation>
If I take the Resource_ID line out it works, but obviously the corresponding resource attribute is null and for what I'm trying to achieve I can't have a null there.

In the GUI the Resource ID is derived from a parameterised lookup which evaluates to SRM_RESOURCES.ID: the code for that is:
SELECT
@SELECT:RES.ID:RESOURCE_ID@,
@SELECT:RES.FULL_NAME:FULL_NAME@,
@SELECT:PAC.TRANSCLASS:TRANSCLASS@
                                
FROM 
SRM_RESOURCES RES, 
PAC_MNT_RESOURCES PAC,
PRTEAM T               

WHERE
RES.IS_ACTIVE = 1
AND T.PRRESOURCEID = RES.ID
AND PAC.ID = RES.ID
AND (PAC.RESOURCE_CLASS = 'non lab' or PAC.TRANSCLASS in ('***', 'YYY'))
AND @where:param:USER_DEF:integer:project_int_id@ = T.PRPROJECTID
AND @WHERE:SECURITY:RESOURCE:RES.ID@                       

@BROWSE-ONLY:
and (@where:param:USER_DEF:integer:project_int_id@ is null 
or @where:param:USER_DEF:integer:project_int_id@ = T.PRPROJECTID)
:BROWSE-ONLY@
and @FILTER@
The hard coded resource ID in the XML above does exist in the database, before anyone asks :wink:
Task_ID in the same object also gets its value from a parameterised lookup so I'm a bit confused. Is there anything particular I need to bear in mind with lookups and XOGging custom attributes?

Thanks

Owen

Outcomes