Skip to main content
1-Visitor
January 18, 2013
Question

Setup participant activity

  • January 18, 2013
  • 2 replies
  • 4819 views

Hi

My problem is-

I have a setup participant activity.there are three roles for which i have to assign participants .For eg. if i assign participant for role A and role B.But if i dont assign anyone for role c.The task is going to the creator .i dont want that if no person is assigned to a role.I dont want it to go to anyone.How should i go about it??

2 replies

GregoryPERASSO
16-Pearl
January 18, 2013

Hello

you can add this code in the "complete transition" of your SetUp participant task, or in a conditionnal robot just behind

wt.workflow.engine.WfProcess wfprocess = ((wt.workflow.work.WfAssignedActivity)self.getObject()).getParentProcess();

java.util.Enumeration pinwf = wfprocess.getPrincipals(wt.project.Role.toRole("MY_ROLE_TO_TEST"));

int count = 0;

while (pinwf.hasMoreElements())

{

count = count+1;

pinwf.nextElement();

}

if count==0 no person have been slelected for this role ... so you can route your workflow differently

regards

Gregory

1-Visitor
January 18, 2013

Thanks a lot mr.gregory...Iam getting the role for which there is no participant but how can i stop the task from going to anyone..

GregoryPERASSO
16-Pearl
January 21, 2013

You can set the "count" as a global workflow variable.

And then after your setup participant task, put a conditionnal robot.

If count = 1, route to the next task where the partipant is needed

If count=0, route to another way with no task for this participant

1-Visitor
October 8, 2013

Hi all,

I know it's an oldish thread, but I didn't want to start a new one on the same subject.

Does anyone have a working example of this code inside a simple workflow? No matter how I try to implement it in WC10.1 M40, it doesn't want to work.

TIA

12-Amethyst
October 8, 2013

HI Bob,

I tried to implement the solution with a littlle bit different approach.

I also have a document for it.

But i dont know how to how to upload a document.So uploaded the picture of the workflow.

It may help you.

Thanks And Regards,

Kaushik

1-Visitor
October 9, 2013

Thanks, Kaushik - unfortunately it does help me a great deal!

The problem is that however I try to implement the code listed in this thread, whether by including it in WorkflowHelper or inside a conditional router, or inside a Complete Transition, I get the following error;

java.lang.ClassCastException: wt.workflow.engine.WfProcess cannot be cast to wt.workflow.work.WfAssignedActivity

Nested exception is: java.lang.ClassCastException: wt.workflow.engine.WfProcess cannot be cast to wt.workflow.work.WfAssignedActivity

wt.util.WTException: java.lang.ClassCastException: wt.workflow.engine.WfProcess cannot be cast to wt.workflow.work.WfAssignedActivity

Nested exception is: java.lang.ClassCastException: wt.workflow.engine.WfProcess cannot be cast to wt.workflow.work.WfAssignedActivity

at wt.workflow.expr.WfExpression97382.execute_ROUTER_EXPRESSION_(WfExpression97382.java:23)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at wt.workflow.definer.WfExpression.invokeByReflectionWithTransaction(WfExpression.java:1204)

at wt.workflow.definer.WfExpression.executeRouter(WfExpression.java:1322)

at wt.workflow.definer.WfExpression.execute(WfExpression.java:416)

at wt.workflow.engine.WfConnector.evaluateRouterExpression(WfConnector.java:586)

at wt.workflow.engine.WfConnector.fire(WfConnector.java:350)

at wt.workflow.engine.WfConnector.fireInput(WfConnector.java:314)

at wt.workflow.engine.ActivityConnectorLink.receiveEvent(ActivityConnectorLink.java:143)

at wt.workflow.engine.StandardWfEngineService.propagateEvent(StandardWfEngineService.java:861)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at wt.queue.QueueEntry.execute(QueueEntry.java:232)

at wt.queue.QueueRunnable.run(QueueRunnable.java:186)

at java.util.concurrent.ThreadPoolExecutor$Worke

What is I'm missing, or doing wrong?

(None of this helped by the fact that I'm not a programmer!!!)


Bob.