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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

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

brawat
2-Explorer

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

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

ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

8 REPLIES 8

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

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"

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

Hi Greg,

I tried but getting same issue.

I tried both ways of using the count variable as local and a global but no help.

I will explain the scenario in detail.

I am using the role only in workflow , it is not a context team role and adding any team member user.

The count variable is not of any significance apart from doing the validation.

I am getting the exception thrown properly when none of the users are added to Setup particpant role.

But after adding a user the task is not getting completed but remains in a hun state with errors in MS log.

<

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"

>

Thanks,

Birendra

Strange ...

In my case, the role is not defined in the context team.

But it is defined in the Team template of my business object (in my case in the team of a WTChangeRequest - set in the OIRs)

regards

I was able to resolve the issue...

the issue was with the while loop, as my requirement needed if condition.

Thanks Greg for responding to my queries.

PreetiGupta
15-Moonstone
(To:brawat)

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.

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

Please find here with the Attachment

Announcements


Top Tags