Flex Fields Attributes Cannot Be Queried or Updated in Pre Trigger Type Event for Script PX (Doc ID 1953459.1)

Last updated on MARCH 03, 2017

Applies to:

Oracle Agile Product Collaboration - Version 9.3.2.0 and later
Information in this document applies to any platform.

Symptoms

Actual Behavior
Find That Flex Field attribute cannot be queried or updated in Pre Trigger Type Event using Script PX. In Post Trigger Type, these attributes can be queried or updated.

Expected Behavior
Flex Field attribute can be queried or updated in Pre Trigger Type Event using Script PX

Reproduce Steps

1) Login as admin user in Java Client

2) Create new FlexField attribute on Page Three for subclass : Part

Name : myFlexAttribute
Type : List
BaseID : 2473327

3) Enable User Defined attribute on Page Three for subclass : Part and name it NormalAttribute

Name : NormalAttribute
Type : List
BaseID : 1547

4) Event

Event Type : Update Title Block
Object Type : Part

5) Event Handlers

Event Handler Type : Script PX
Name : get/set dirty agile flex value

Role : Administrator
Script :

import com.agile.agileDSL.ScriptObj.IBaseScriptObj;
import com.agile.agileDSL.ScriptObj.AgileDSLException;
import com.agile.px.EventConstants;
import com.agile.api.ItemConstants;

void invokeScript(IBaseScriptObj obj) {

int eventType=obj.getEventType();
int triggerType=obj.getEventTriggerType();

// Set attribute ID
int attId = 2473327; //my flex attribute
//int attId = 1547;  //page_three.list39

if (triggerType == EventConstants.EVENT_TRIGGER_PRE)
{
// try to get dirty value on agile_flex attribute
String dirtyValue = obj.getDirtyAttrValue(attId);
if (dirtyValue == '') {throw new AgileDSLException("flex attribute value is null!");}

// try to set dirty value on agile_flex attribute
String newDirtyValue = "Yes";
obj.setDirtyAttrValue(attId, newDirtyValue);
obj.logMonitor("old value = " + dirtyValue + ";new value = " + newDirtyValue);
}

if (triggerType == EventConstants.EVENT_TRIGGER_POST)
{
String oldValue = obj.getValueByAttId(attId);
String newValue = "Yes";
obj.setValueByAttId(attId, newValue);
obj.logMonitor("old value = " + oldValue + ";new value = " + newValue);
}

} // end of invokeScript

6) Event Subscriber

Name : Update Title Block Part get/set dirty agile flex value
Event : Update Title Block Part
Event Handler : get/set dirty agile flex value
Trigger Type : Pre
Execution Mode : Synchronous
Order : 0
Error Handling Rule : Stop

7) Set Read, Modify, Discover privileges for the admin user on each new attribute, part

8) Create part : P00213 from Web Client

NormalAttribute : No
myFlexAttribute : No

9) Set the Event Handler: get/set dirty agile flex value to yes from Java Client

10) Set the myFlexAttribute : Yes and save. See the following warning message.

flex attribute value is null!

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms