Introductory Rev Value in a Script
I just modified the “Add AI Set Rev” PX, or the “Update Revision of Affected Items when Adding an Item to the AI table” for myself and I’m having trouble getting the Introductory Revision.
So, from the default script on the Oracle script examples page, here’s my script edits:
…
Object oldRevObj = row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_OLD_REV);
String oldRev = oldRevObj == null? “” : oldRevObj.toString();
if (oldRev == “AA”)
row.setValue(ChangeConstants.ATT_AFFECTED_ITEMS_REVISION, “AB”);
//and so on…
if (row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_OLD_REV).equals(“Introductory”))
row.setValue(ChangeConstants.ATT_AFFECTED_ITEMS_REVISION, “AA”);
}
obj.logMonitor(“Successful set new Affected Item revision using PX Script” );
I have also tried:
//Attempt 1
if (oldRev == null)
row.setValue(ChangeConstants.ATT_AFFECTED_ITEMS_REVISION, “AA”);
//Attempt 2
if (oldRev == “Introductory”)
row.setValue(ChangeConstants.ATT_AFFECTED_ITEMS_REVISION, “AA”);
…
And none of the three are updating the Introductory revision.
What do you think I’m missing?
oldRev is empty string, so try the following
if (oldRev.equals(“”)) {
row.setValue(ChangeConstants.ATT_AFFECTED_ITEMS_REVISION, “AA”);
}
BR, Nimish