Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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
Solved! Go to Solution.
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
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.
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