Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi,
is there any possibility to create (and update later) automaticly a bunch ( >50 ) of workflows by
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
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