How to set affected item’s p3 value with action menu button

I have append a sync button in action menu, use senerio as follow:

When user click this button, then get affected item from currently ECO, then set those items P3 value throught redline mode.

 

import com.agile.api.*;
import com.agile.px.*;
import com.agile.agileDSL.ScriptObj.IBaseScriptObj
import com.agile.agileDSL.ScriptObj.AgileDSLException
void invokeScript(IBaseScriptObj obj) {
obj.logMonitor(“Starting…”);
IObjectEventInfo event = obj.getPXEventInfo();
IDataObject dataObject = event.getDataObject();
if (dataObject instanceof IChange) {
IChange ctxChange = (IChange) dataObject;
ITable tableAI = ctxChange.getTable(ChangeConstants.TABLE_AFFECTEDITEMS);
for (Iterator iter = tableAI.iterator(); iter.hasNext();) {
IRow row = iter.next();
String site =  row.getValue(ChangeConstants.ATT_AFFECTED_ITEMS_SITES)?.toString();
if (“”.equalsIgnoreCase(site)) {
IItem rlItem = row.getReferent();
String getValue = rlItem.getValue(1542)?.toString();
rlItem.setRedlinedValue(1592, getValue);
}

}
}
obj.logMonitor(“Finished…”)
}

After click button generated  an eror message:No signature of method: com.agile.api.pc.item.Item.setRedlinedValue() is applicable for argument types: (Integer, String) values: [1592, AAA]

 

I hope some body can help me, I want to know how to fix this issue, or maybe Agile havn’t support redline throught API to update affected items P3 value.

 

Agile User Asked on December 11, 2024 in Software Development Kit (API).
Add Comment
2 Answer(s)

Dear Chelen,

I’ve done a few groovy script PXs, but I’m by no means an expert on Agile’s API methods. That said, I’m going to ask the obvious question first… Attribute 1592 refers to the generic Text18 of PAGE_THREE.TEXT48. Since Page 3 attributes vary from subclass to subclass, do the affected items in your case have that attribute enabled? I believe it must be enabled in order to set it.

I also found another article in this forum that may be of use. Hope this helps.

Steve

How to redline the page 2 and page 3 attributes of an item using webservices?? – MyAgilePLM

Agile Professional Answered on January 2, 2025.
Add Comment

Hi,

Not sure if you have resolved this, but i have never used (or seen) a method called “setRedlinedValue()” with the Agile API.  Here’s how I usually do it (I would replace your “rlItem.setRedlinedValue(1592, getValue);” with the following:

IRow redlinedPageThreeRow = (IRow) rIItem.getTable(ItemConstants.TABLE_REDLINEPAGETHREE).iterator().next();

ICell redlinedCell = redlinedPageThreeRow.getCell(1592);

redlinedCell.setValue(getValue);

Agile Talent Answered on January 16, 2025.
Add Comment

Your Answer

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