cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Getting Workflow process variables

MichaelIbosh
1-Newbie

Getting Workflow process variables

Does anyone have a workflow code snip-it that from the change order process, will get a related change activity process variable value? In the CO process, I can get the associated change activities, but I need to get the value of a variable from that change activity. Any help would be much appreciated.

Mike

1 REPLY 1

Hi Mike

You could try something as below.



public static Object getProcessVariable(Object obj, String wfvariable) {

Enumeration processEnum = null;

Object wfVar = null;

try {

// getAssociatedProcesses(Persistable
persistable, WfState wfstate, WTContainerRef wtcontainerref)

processEnum = WfEngineHelper.service.getAssociatedProcesses((Persistable)
obj,null,null);



while (processEnum.hasMoreElements()) {

// get the wfprocess

WfProcess wfprocess =
(WfProcess) processEnum.nextElement();

// get the processData

ProcessData processData =
wfprocess.getContext();

wfVar = (Object)
processData.getValue(wfvariable);

if (wfVar != null) break;

}

} catch (WTException e) {

e.printStackTrace();

}

return wfVar;

}



Thank you and have a great time.

Best Regards

Swamy Senthil

Principal Solutions Architect

973 216 0456(M); 973 324 2729(W); 866 908 6561(F)

Work Email: swamy.senthil@swasen.com

LinkedIn Profile:
Top Tags