Parameter Driven Lookup errors when in audit trail
search cancel

Parameter Driven Lookup errors when in audit trail

book

Article ID: 268228

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

Dynamic Lookup Attribute Issue with Audit Trail.

Steps to Reproduce: 
 
1. Create a master object (master, ID = cmaster)
2. Create first sub object tied to the master object (sub1, ID = sub1)
a. Create a lookup with the following NSQL:
SELECT 
@SELECT:d1.p_id:p_id@,
@SELECT:d1.p_name:p_name@,
@SELECT:d1.description:description@,
@SELECT:d1.start_date:start_date@,
@SELECT:d1.end_date-1:end_date@,
@SELECT:d1.last_updated_date:last_updated_date@,
@SELECT:d1.is_active:is_active@,
@SELECT:d1.language_code:language_code@,
@SELECT:d1.language_id:language_id@
from (
select p.id p_id, nls.name p_name, nls.description description, p.start_date start_date, p.end_date-1 end_date, p.last_updated_date, p.is_active, 'en' language_code, lang.id language_id
from biz_com_periods p
inner join cmn_captions_nls nls on p.id = nls.pk_id and nls.table_name = 'BIZ_COM_PERIODS'
inner join cmn_languages lang on nls.language_code = lang.language_code and nls.language_code = 'en'
where p.period_type = 'ANNUALLY') d1
where 1=1
@BROWSE-ONLY:
and d1.is_active = 1
and d1.p_id not in
(
Select nvl(fiscal_year,999999999999)
from odf_ca_sub1
where (@WHERE:PARAM:USER_DEF:INTEGER:parent_id@ = odf_parent_id)
)
:BROWSE-ONLY@
AND @FILTER@
b. Create an attribute on the sub object called Fiscal Year (id: fiscal_year)
i. Use the lookup you just created as the data type
ii. Value required – True
iii.Lookup Parameter Mapping: parent_id -> odf_parent_id
iv. Add the attribute to the audit trail for changes, insert, and delete
 
3. Create second sub object tied to the master object
a. Create another lookup with the following NSQL:
SELECT @SELECT:d1.p_id:p_id@,
@SELECT:d1.p_name:p_name@,
@SELECT:d1.description:description@,
@SELECT:d1.start_date:start_date@,
@SELECT:d1.end_date:end_date@,
@SELECT:d1.last_updated_date:last_updated_date@,
@SELECT:d1.is_active:is_active@,
@SELECT:d1.language_code:language_code@,
@SELECT:d1.odf_parent_id:odf_parent_id@,
@SELECT:d1.language_id:language_id@
from (
select ca.fiscal_year p_id, nls.name p_name, nls.description description, p.start_date start_date, p.end_date-1 end_date, p.last_updated_date, p.is_active, 'en' language_code, ca.odf_parent_id, lang.id language_id
from odf_ca_sub1 ca
join biz_com_periods p on p.id = ca.fiscal_year
inner join cmn_captions_nls nls on p.id = nls.pk_id and nls.table_name = 'BIZ_COM_PERIODS'
inner join cmn_languages lang on nls.language_code = lang.language_code and nls.language_code = 'en') d1
where 1=1
@BROWSE-ONLY:
and d1.is_active = 1
and (@WHERE:PARAM:USER_DEF:INTEGER:parent_id@ = d1.odf_parent_id or @WHERE:PARAM:USER_DEF:INTEGER:parent_id@ is null)
:BROWSE-ONLY@
AND @FILTER@
b. Create an attribute on the sub object called Fiscal Year (id: fiscal_year)
i. Use the lookup you just created as the data type
ii. Value required – True
iii.Lookup Parameter Mapping: parent_id -> odf_parent_id
iv. Add the attribute to the audit trail for changes, insert, and delete
 
4. Create a record on the master object
5. Open the record and create a record on the first sub object. Select any FY value
6. Create a record on the second sub object using that FY value
7. Create another record on the master object. Repeat steps 5-6. You should be thrown an error in the GUI after trying to create a record on the second sub object
 
 
Expected Results: It should not throw an error
 
Actual Results: It is throwing an error related to audit trail function.

Environment

Release : 16.1.1

Resolution

DE70436, Engineering team reviewed it and below is the solution.

Proposed a solution with modified NSQL for the second lookup:

We introduced "DISTINCT" to the query and excluded "ODF_PARENT_ID" from the result set.

SELECT DISTINCT @SELECT:d1.p_id:p_id@,
@SELECT:d1.p_name:p_name@,
@SELECT:d1.description:description@,
@SELECT:d1.start_date:start_date@,
@SELECT:d1.end_date:end_date@,
@SELECT:d1.last_updated_date:last_updated_date@,
@SELECT:d1.is_active:is_active@,
@SELECT:d1.language_code:language_code@,
@SELECT:d1.language_id:language_id@
from (
select ca.fiscal_year p_id, nls.name p_name, nls.description description, p.start_date start_date, p.end_date-1 end_date, p.last_updated_date, p.is_active, 'en' language_code, ca.odf_parent_id, lang.id language_id
from odf_ca_sub1 ca
join biz_com_periods p on p.id = ca.fiscal_year
inner join cmn_captions_nls nls on p.id = nls.pk_id and nls.table_name = 'BIZ_COM_PERIODS'
inner join cmn_languages lang on nls.language_code = lang.language_code and nls.language_code = 'en') d1
where 1=1
@BROWSE-ONLY:
and d1.is_active = 1
and (@WHERE:PARAM:USER_DEF:INTEGER:parent_id@ = d1.odf_parent_id or @WHERE:PARAM:USER_DEF:INTEGER:parent_id@ is null)
:BROWSE-ONLY@
AND @FILTER@