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.

Automated workflow creation

Franky
1-Newbie

Automated workflow creation

Hi,

is there any possibility to create (and update later) automaticly a bunch ( >50 ) of workflows by

  • creating config files or
  • creating import files and importing them or

I don't think it's feasible to create every workflow by hand, so I would like to create them in a batch.

I would like to connect these workflows to a document each (a real document or an empty one)

The documentation on workflows is very sparse, so I would appreciate any information about it.

Cheers

Frank

1 REPLY 1

Hi,

You can try something like that :

public

static void launchNewProcess(EPMDocument o, String WFName, String setName, String setDescription)

{

try

{

QuerySpec qs =

new QuerySpec(WfProcessTemplate.class);

SearchCondition sc =

new SearchCondition(WfProcessTemplate.class, "name", SearchCondition.EQUAL, WFName);

qs.appendWhere(sc,

new int[] { 0, 0 });

QueryResult qr = PersistenceHelper.

manager.find((StatementSpec) qs);

WfProcessTemplate wfpt =

null;

while (qr.hasMoreElements())

{

wfpt = (WfProcessTemplate) qr.nextElement();

if (wfpt.isLatestIteration())

{

break;

}

}

WfProcess aProcess = WfEngineHelper.

service.createProcess(wfpt, o.getTeamId(), o.getContainerReference());

aProcess.setName(setName);

aProcess.setDescription(setDescription);

aProcess.setPriority(1);

aProcess = WfEngineServerHelper.

service.setPrimaryBusinessObject(aProcess, o);

ProcessData context = aProcess.getContext();

aProcess = WfEngineHelper.

service.startProcess(aProcess, context, 1);

}

catch (Exception e)

{

e.printStackTrace();

}

}

Morgan

Top Tags