on 11-19-2008 1:33 PM
Hi All,
I have a requester - approver process where I want to assign list of users to Processor for Approval role.
I am getting list in requester CO and at design-time I have declared Processor for Approval as runtime defined in roles tab of process.
Can anybody tell me how to add this users to this role programmatically? may b in execute method or in complete() method?
I came across with one method which looks promising :
IGPRuntimeManager rtManager = GPProcessFactory.getRuntimeManager();
rtManager.addRuntimeDefinedUser();
This method requires IGPProcessInstance and other parameters. Can I get some info abt how to get them?
Sample code will be most welcome.
Thanks and regards,
Amey Mogare
IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user2 = wdUser.getSAPUser();
IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(user2);
IGPProcessInstance prInstance = rtm.getProcessInstance(executionContext.getProcessId(), userContext);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can get those parameters from the executionContext parameter present in the execute() method
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for helpful replies.
I am trying following piece of code inside execute() method of RequesterCO, but when I check Worklist of approver user, its empty. That means this user is not getting assigned to this process role.
(Before that in roles tab of process, i have defined "Processor for Approval" as runtime defined.)
IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
IUser userJames = UMFactory.getUserFactory().getUserByLogonID("James.bond");
IGPUserContext userContext = GPContextFactory.getContextManager().createUserContext(userJames);
IGPProcessInstance prInstance = rtm.getProcessInstance(executionContext.getProcessId(),userContext);
rtm.addRuntimeDefinedUserToRole(prInstance, "Processor of NewApprovalAction", userJames, userContext);
Can you please suggest? And is it possible to add more than one user to same process role using above way?
Regards,
Amey Mogare
Edited by: Amey Mogare on Nov 19, 2008 4:14 PM
Edited by: Amey Mogare on Nov 19, 2008 4:30 PM
Oops !!!
I got it. Actually you are supposed to enter Technical name of the action as role in this method...
So when I did it, it worked !!!
IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();
IUser userJames = UMFactory.getUserFactory().getUserByLogonID("James.bond");
IUser userSuperman = UMFactory.getUserFactory().getUserByLogonID("Super.man");
IGPUserContext userContext1 = GPContextFactory.getContextManager().createUserContext(userJames);
IGPUserContext userContext2 = GPContextFactory.getContextManager().createUserContext(userSuperman);
IGPProcessInstance prInstance = rtm.getProcessInstance(executionContext.getProcessId(),userContext1);
IGPProcessInstance prInstance = rtm.getProcessInstance(executionContext.getProcessId(),userContext2);
rtm.addRuntimeDefinedUserToRole(prInstance, "Action_3", userJames, userContext1);
rtm.addRuntimeDefinedUserToRole(prInstance, "Action_3", userSuperman, userContext2);
This adds the James.bond and Super.man to role "Processor of ApprovalAction" that is "Action_3" !!!
Thanks a lot for your replies guys !!! It helped to achieve it.
Regards,
Amey Mogare
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.