Cannot access record with AGILEOBJECTIDSEQUENCE

This is another question in a series… The root of the problem is that we cannot get the latest rev that is at Preliminary state when connected to an ECO as a pending change.  The UI search and PX commands always go to the latest released rev which is at production.  The AGILEOBJECTIDSEQUENCE is the DB identifier specific to a row which is a revision.

When we tried to set the object using the AGILEOBJECTIDSEQUENCE we got a  java.lang.NullPointerException indicating that the PX cannot reference the IDSEQUENCE directly.

Here is the code:

public EventActionResult doAction(IAgileSession session, INode actionNode, IEventInfo req) {

try {
int eventType = req.getEventType();

if (eventType != EventConstants.EVENT_UPDATE_TABLE) {
logger.info(“The PX is only applicable for Manufacture Table Update”);
return new EventActionResult(req,
new ActionResult(ActionResult.STRING, “The PX is only applicable for Manufacture Table Update.”));
}

IUpdateTableEventInfo updateTableEventInfo = (IUpdateTableEventInfo)req;
IDataObject sourceObj = updateTableEventInfo.getDataObject();

Integer sourceClassId = (Integer)(sourceObj.getAgileClass().getId());
String sourceName = sourceObj.getName();
int sourceSubClassId = getSubClass(sourceObj.getId());
int sourceObjId = getObjectID(sourceObj.getId());
String sourcePublicKey = String.valueOf(sourceObjId) + REFERENCE_OBJ_PUBLIC_KEY_DELIMITER + sourceSubClassId;
logger.info(“sourceName:” + sourceName + ” , sourceObj: ” + sourceObj + “, sourceClassId:” + sourceClassId);

HashMap param = new HashMap();
param.put(ItemConstants.ATT_INSTANCES_ITEMNAME, sourceClassId);

IItem change = (IItem )session.getObject(IItem .OBJECT_TYPE, param);

return new EventActionResult(updateTableEventInfo, new ActionResult(ActionResult.STRING, objectsAffected.toString()));
} catch (Throwable th) {
th.printStackTrace();
logger.info(“In the Catch block and the exception is ” + th.getMessage());
return new EventActionResult(req, new ActionResult(ActionResult.EXCEPTION, th));
}

}

 

 

How do we access the Preliminary Rev [(003) EC02904] of a part that is on an EC to make updates and changes when all of the PX commands are referencing the Production Revision [002 EC02903].?

Add Comment
1 Answer(s)

Hello

AGILEOBJECTIDSEQUENCE is primarily at DB level and you cannot use in SDK

For your issue, I assume the PX is firing at ECO2904. If so, using the updateTableEventInfo, get the iterator and do a getReferent() for the row your item is on. That should directly give you the pending change and you should be able to do what you want

Hope this helps

– Raj

Agile Angel Answered on August 31, 2019.

The PX is firing from an Event on the Part Manufacturer tab which is being changed on the ECO Affected Items Redline Manufacturer Tab.  The ECO Event would have to trigger for any Affected item change and this is much more general (lot more changes) than Manufacturer Changes.  Does that change what you are suggesting?

on September 1, 2019.

Ah ok. Then you have the PX set on Item and Manufacturers tab. In that case, once you get the item, do a item.setRevision(“ECO2904”). That will make sure you have the context to the item at the pending change. Else, it will point to latest released rev

on September 2, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.