Skip to main content
1-Visitor
October 4, 2012
Solved

I want to add a check to have atleast one participant in a specific role under Setup participant table

  • October 4, 2012
  • 8 replies
  • 5677 views

We are useing Windchill 10M020, We have created a workflow where in for a particular task I am asking user to add/remove user from Setup participant table in a task.

But I want to be sure that atleast one user is selected under the define role in setup particpant table before completing the assigned task.

So can anyone suggest me how to check the above condition ?

Regards,

Birendra

Best answer by GregoryPERASSO

Hello

in the workflow task, you can add in the complete transition, a peace of java code that will check if there's a user in the Role

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

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

int count = 0;

while (pinwf.hasMoreElements())

{

count = count+1;

}

if count>0 there's a user define in the setup participant

else, you can route the workflow to a new task to fix it ...

regards

8 replies

GregoryPERASSO
16-Pearl
October 4, 2012

Hello

in the workflow task, you can add in the complete transition, a peace of java code that will check if there's a user in the Role

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

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

int count = 0;

while (pinwf.hasMoreElements())

{

count = count+1;

}

if count>0 there's a user define in the setup participant

else, you can route the workflow to a new task to fix it ...

regards

brawat1-VisitorAuthor
1-Visitor
October 5, 2012

Thanks Greg, the setup participant validation worked.

But now I can see that the task is not getting completed and error is MS log as below.

"

P-Processor3: 2 warnings, no errors were found!

Fri 10/5/12 15:38:45: TP-Processor3: varInfo :: [self, wt.fc.ObjectReference, false, false, false, false, LOCAL, null] : componentId :: special_instructions

Fri 10/5/12 15:38:45: TP-Processor3: varInfo :: [primaryBusinessObject, wt.fc.WTObject, false, true, true, true, INOUT, null] : componentId :: special_instructions

Fri 10/5/12 15:38:45: TP-Processor3: varInfo :: [special_instructions, java.lang.String, false, true, true, true, INOUT, null] : componentId :: special_instructions

Fri 10/5/12 15:38:45: TP-Processor3: varInfo :: [self, wt.fc.ObjectReference, false, false, false, false, LOCAL, null] : componentId :: all_activity_variables

Fri 10/5/12 15:38:45: TP-Processor3: varInfo :: [primaryBusinessObject, wt.fc.WTObject, false, true, true, true, INOUT, null] : componentId :: all_activity_variables

Fri 10/5/12 15:38:45: TP-Processor3: varInfo :: [special_instructions, java.lang.String, false, true, true, true, INOUT, null] : componentId :: all_activity_variables

Fri 10/5/12 15:39:14: TP-Processor3: ERROR : com.ptc.core.htmlcomp.components.TableViewBean vikas.vir - Could not find configurable table with id: workflow.setupParticipantsComponent"

GregoryPERASSO
16-Pearl
October 8, 2012

Hello

may be it depends how you handle the count ... and how you

In my workflow, the count value is a global workflow variable. In the complete transition, I'm only populate it with the above java code .

After that, in an other conditional robot. I test it to know if >0. And then the conditionnal robot routes to a new Setup participant task or to the normal way if a user is already defined ...

be carefull if you make a loop in your workflow to check the box "loop" in your arrows ... they should be in red ...

regards

15-Moonstone
October 4, 2012

This is exactly what we do. At complete transition we call a workflow helper method which gets the role name as input and check whether there is any user populated in that role.

I dont think you can do any thing with Setup Participant wizard in particular.

1-Visitor
December 29, 2014

We can Do it Though UI Customization as well using the Setup Participant Table Builder.

Please find here with the Attachment