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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

About Using Participant İn Workflow

OnurNalbantoglu
13-Aquamarine

About Using Participant İn Workflow

hello, I have a workflow and in this workflow, the flow goes to different parts according to the values ​​in the global enumeration in the attribute in a particular layout. In fact, I make users choose a section, and as a result, the flow progresses according to the selected section.

 

onur_0-1670506923155.png

onur_2-1670507122475.png

 

onur_1-1670506987958.png

 

 

 

The problem is that I do this for each partition and I have 30 partitions in total. which means task and etc required for 30 sections.

How should I use something here so that the participant I selected directly finds the role or group in the enumeration?

7 REPLIES 7

Can you explain better? I loathe these fanned workflows for this reason. What happens in each sub-workflow block you show there?

Hello avillanueva,
sorry for my late reply,

there is only task inside the blocks. I'm sending a task to a user whose name I just specified. For example "tanker silo manager".

 

onur_0-1670913217464.png

onur_0-1670913398743.png

 

 

 

 

rhart
14-Alexandrite
(To:OnurNalbantoglu)

Maybe it would be cleaner the write an expression to add the group into the role, instead of all those blocks.

 

// find the team for this wf
wt.team.Team team = (wt.team.Team) ((wt.workflow.engine.WfProcess) self.getObject()).getTeamId().getObject();

wt.org.WTPrincipal wtprincipaltoadd = //the principal to add into the role

// remove everyone/anyone else from the role
java.util.Enumeration principals = team.getPrincipalTarget(wt.project.Role.toRole("SUBMITTER")); // the role KEY = SUBMMITER

while(principals.hasMoreElements())
{
	wt.org.WTPrincipalReference principalRef = (wt.org.WTPrincipalReference)principals.nextElement();
	wt.org.WTPrincipal wtprincipal = principalRef.getPrincipal();
	wt.team.TeamHelper.service.deleteRolePrincipalMap(wt.project.Role.toRole("SUBMITTER"), wtprincipal, team ); 
}

// add principal to the SUBMITTER role
wt.team.TeamHelper.service.addRolePrincipalMap(wt.project.Role.toRole("SUBMITTER"), wtprincipaltoadd, team);

 

OnurNalbantoglu
13-Aquamarine
(To:rhart)

What does submitter do? 

I can direct the flow according to the section selections entered by the users, but when I want to send the tasks to the necessary people, I have to choose a separate participant for each section, which intensifies the flow. Is there any way I can do this problem in a single domain?

I can select participants according to the section selected below, but I need to create another one for a different section.

onur_0-1670938466295.png

 

rhart
14-Alexandrite
(To:OnurNalbantoglu)

In my case the Submitter is the Role name for the user who submitted something for a review.

You can assign the task to always the same Role, the expression I shared above shows how to add a principal into the Role.

smcvr
14-Alexandrite
(To:rhart)

I examined the code you gave and tried to assign the principal assignment part with the username directly, but it gave me this error

 

wt.team.Team team = (wt.team.Team) ((wt.workflow.engine.WfProcess) self.getObject()).getTeamId().getObject();
wt.org.WTPrincipal principal = wt.org.OrganizationHelper.getPrincipal("userName");

java.util.Enumeration principals = team.getPrincipalTarget(wt.project.Role.toRole("Submitter"));

while(principals.hasMoreElements())
{
wt.org.WTPrincipalReference principalRef = (wt.org.WTPrincipalReference)principals.nextElement();
wt.org.WTPrincipal wtprincipal = principalRef.getPrincipal();
wt.team.TeamHelper.service.deleteRolePrincipalMap(wt.project.Role.toRole("Submitter"), wtprincipal, team );
}

wt.team.TeamHelper.service.addRolePrincipalMap(wt.project.Role.toRole("Submitter"), principal, team);

 

--------------------------------------------------------------------------------------------------

WfExpression_11.java:75: error: cannot find symbol
wt.org.WTPrincipal principal = wt.org.OrganizationHelper.getPrincipal("sumeyye.cevahir");
^
symbol: class OrganizationHelper
location: package wt.org
Note: WfExpression_11.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

rhart
14-Alexandrite
(To:smcvr)

If you wanted to assign a particular user to the submitter role with code, although I can't really see why you'd ever want to do that.

 

wt.org.DirectoryContextProvider dcp = wt.org.OrganizationServicesHelper.manager.newDirectoryContextProvider((String[])null,(String[])null);

String email = "tom@ptc.com";
java.util.Enumeration principalsusers = wt.org.OrganizationServicesHelper.manager.findLikeUsers ( wt.org.WTUser.E_MAIL, email, dcp );

if (principalsusers != null && principalsusers.hasMoreElements () ){
wt.org.WTPrincipal wtprincipaltoadd = (wt.org.WTUser)principalsusers.nextElement();
wt.team.TeamHelper.service.addRolePrincipalMap(wt.project.Role.toRole("SUBMITTER"), wtprincipaltoadd, team);
}

 

Would need to add handling of the error when the user is not found inevitably.

Top Tags