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?

No Files Were Attached
Matt Paulhus Agile Professional Asked on June 12, 2017 in Product Collaboration.
Add Comment
2 Answer(s)
Best answer

oldRev is empty string, so try the following

if (oldRev.equals(“”)) {
row.setValue(ChangeConstants.ATT_AFFECTED_ITEMS_REVISION, “AA”);

BR, Nimish

nimishh Agile User Answered on June 13, 2017.
Add Comment

Thanks you, Nimish – that worked.

Matt Paulhus Agile Professional Answered on June 13, 2017.
Add Comment

Your Answer

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