I have a groovy where I need to set the workflow on save as but for some reason I can´t get the object.

As explained at the title, please see my groovy:

import com.agile.agileDSL.ScriptObj.IBaseScriptObj;
import com.agile.agileDSL.ScriptObj.AgileDSLException;
import com.agile.api.DeclarationConstants;
import com.agile.api.IAgileSession;
import com.agile.px.IEventInfo;
import com.agile.px.EventConstants;
import com.agile.api.IItem;
import com.agile.api.IDeclaration;

void invokeScript(IBaseScriptObj obj) {

String newNumber = obj.getNewNumber();
obj.logMonitor(newNumber + ‘|’);

IAgileSession session = obj.getAgileSDKSession();
IEventInfo req = obj.getPXEventInfo();

IDeclaration dec = (IDeclaration) session.getObject(DeclarationConstants.CLASS_SUBSTANCE_DECLARATIONS_CLASS, newNumber);
obj.logMonitor(dec + ‘|’);

try {
int eventType=req.getEventType();
int triggerType=req.getEventTriggerType();

// The PX is only applicable for post update event
if(eventType!=EventConstants.EVENT_SAVE_AS_OBJECT || triggerType!=EventConstants.EVENT_TRIGGER_PRE)

Object DeclarationTypeObj = obj.getValueByAttId(DeclarationConstants.ATT_COVER_PAGE_DECLARATION_TYPE);
String DeclarationType = DeclarationTypeObj == null? “” : DeclarationTypeObj.toString();
obj.logMonitor(DeclarationType + ‘|’);

obj.setValueByAttId(DeclarationConstants.ATT_COVER_PAGE_WORKFLOW, DeclarationType)
newWorkflow = obj.getValueByAttId(DeclarationConstants.ATT_COVER_PAGE_WORKFLOW);

// log para o Event Handler Monitor

} catch (Exception e)
throw new AgileDSLException(e);

} // end of try catch block

} // end of invokeScript

It completes the groovy but for some reason the getobject is returning NULL as you can see at the message generated by the log monitor:

MD00119|null|Substance Declaration|Substance Declaration

Thanks in advance.

No Files Were Attached
Add Comment
0 Answer(s)

Your Answer

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