Groovy PX:: is there a way to set null to a script object?
I need to set null to an object based on a certain condition.. However, when I use:
obj.setValueByAttId(ItemConstants.ATT_PAGE_TWO_LIST01, null);
or
obj.setValueByAttId(ItemConstants.ATT_PAGE_TWO_LIST01, ” “);
it doesn’t work.
Hey Himani,
I also came across same error, but this issue is resolved when I set List Attribute to ‘Required=No’ . Then input this code Object.setValue(“list15”,null);
This should work. Let me know if this works.
I’ve gotten something similar to work. This script nullifies a value during a Save As.
import com.agile.agileDSL.ScriptObj.*;
import com.agile.agileDSL.ScriptObj.AgileDSLException;
import com.agile.agileDSL.ScriptObj.IBaseObjectScriptObj;
import com.agile.api.*
void invokeScript(IBaseScriptObj obj) {
String newNumber = obj.getNewNumber()
IAgileSession session = obj.getAgileSDKSession();
IItem newItem = (IItem) session.getObject(ItemConstants.CLASS_PARTS_CLASS, newNumber);
try{
IItem item = (IItem) session.getObject(IItem.OBJECT_TYPE, newNumber);
item.setValue(ItemConstants.ATT_PAGE_TWO_LIST23, null);
}catch (Exception e) {
obj.logMonitor( e.getMessage() );
}
obj.logMonitor(“Successful nullify List value” );
}
Hi Matt,
I tried your script on Agile 9.3.5 provided by you it works fine. But we have to change the required to No as mentioned by surabh then only it will work.
Regards,
Ganesh