Skip to Content
0
Jan 11, 2011 at 09:26 AM

How to add users to role at run time in GP Process

18 Views

Hi to all,

I tried in different ways to add user to process role dynamically like

IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(adminUser);
IGPProcess process = GPProcessFactory.getDesigntimeManager().getActiveTemplate(	ProcessID, userContext);
IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
IGPProcessRoleInstanceList roles = rtm.createProcessRoleInstanceList();
for (int i = 0; i < rolenum; i++) {
//			   create a new role instance by specifying the role's unique name
IGPProcessRoleInstance roleInstance = roles. createProcessRoleInstance(process.getRoleInfo(i).getRoleName());
strRoleName = process.getRoleInfo(i).getRoleName();
if(strRoleName.equalsIgnoreCase("1st_Approver_new")) 
{
   roleInstance.addRuntimeDefinedUser(userRequesterUser);
                                itried also roleInstance.addUser(userRequesterUser);
   roles.addProcessRoleInstance(roleInstance); 
}

here my requirement is add user role of second action in process.

and i tried design time settings for second action is

1.assigned default user for role

2.run time overwrite

3.Runtime defined

in this not getting any exception but whoever added dynamically for second action ,not getting any pending tasks in his work lists.

for this..... is required any more in api side or settings required at design time ?