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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Issues after populating a role programatically

sdrzewiczewski
10-Marble

Issues after populating a role programatically

I have a need to send an email out to a list of selected roles. A user selects one or more values from a multivalued attribute on the change object. This get's read in and stored in an arraylist. I then have a method that takes a role and populates another role with the members of the fromRole.

This works great from the perspective that I can see that the team instance has been updated with the new people in the role, but when I add that role to the recipient of an email robot, the users are not emailed. If assign the role to an assigned activity, they do get the assigned activity.

Below is the method that I'm using to copy the participants from one role to another. Any idea why the email robot would work differently?


staticsetRoleParticipants(ObjectReference self, String toRole, String fromRole){


try

participants = team.getPrincipalTarget(from_role);


(participants.hasMoreElements()){

TeamHelper.


service

}


(WTException e) {

e.printStackTrace();


}


}


5 REPLIES 5

The code didn't format properly. I've updated the original post, and here it is again

public static void setRoleParticipants(ObjectReference self, String toRole, String fromRole){
Role to_role = Role.toRole(toRole);
Role from_role = Role.toRole(fromRole);
Team team = (Team)((TeamManaged)(self.getObject())).getTeamId().getObject();

Enumeration participants;
try {
participants = team.getPrincipalTarget(from_role);
while(participants.hasMoreElements()){
WTPrincipal wtprincipal = ((WTPrincipalReference)participants.nextElement()).getPrincipal();
TeamHelper.service.addRolePrincipalMap( to_role, wtprincipal, team );
}
} catch (WTException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

Has anybody done anything similar to this, where the populate a role programatically during a workflow, and then use a Notification Robot, to email to that role?

I have but only in a basic fashion. I set the "Creator" of the PBO and set it to a custom role that subsequently received notifications iirc.

[cid:image001.gif@01CDFFCC.F6DB9790]

Steve Vinyard
Application Engineer

On 01/31/13 14:50, Stephen Drzewiczewski wrote:
>
> Has anybody done anything similar to this, where the populate a role programatically during a workflow, and then use a Notification Robot, to email to that role?
>

I do that in our Promotion Request workflow. I have attached the code that does the role populating - in this case setting the approver for the promotion request.

>
> -----End Original Message-----


--
------------------------------------------------------------------------
Randy Jones
Systems Administrator
Great Plains Mfg., Inc.
1525 E North St
PO Box 5060
Salina, KS USA 67401
email: -
Phone: 785-823-3276
Fax: 785-667-2695
------------------------------------------------------------------------

The issue has been resolved. My development environment was the culprit (desperately in need of a refresh..) Moving the code to my validation environment, everything functioned as expected.


Thanks to those who replied.

Announcements


Top Tags