Skip to main content
10-Marble
January 29, 2013
Question

Issues after populating a role programatically

  • January 29, 2013
  • 5 replies
  • 1348 views
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

10-Marble
January 29, 2013
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();
}
}
10-Marble
January 31, 2013

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?

1-Visitor
January 31, 2013
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
20-Turquoise
January 31, 2013
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
------------------------------------------------------------------------

10-Marble
February 1, 2013

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.