Getting tasks for all users in a role

Hi,
We need to get all users in a Role, and out of those, find out which one has the least tasks in their UWL using a WebService. Saw some example codes and here's my attempt at it. Doesn't quite work, I'm getting the Logged in users context or session doesn't exist Exception. Any help on this will be GREATLY appreciated.
public class LeastTasksBean implements LeastTasksLocal {
     public String getUserLeastTasks( String sRole )
          try{
               Map<String, String> users = new HashMap<String, String>();
               Map<String, String> tasks = new HashMap<String, String>();
               final int sessionIdleTimeout = 60;
               String Users[] = UMFactory.getRoleFactory().getUsersOfRole( sRole, true );
               if( Users != null ){
                    for( int i = 0; i < Users.length; i ++ ){
                         UWLContext  uwlContext      = new UWLContext();
                         IUWLService uwlService      = findService();
                         uwlContext.setAllowBackEndConnections( true );
                         IUser uwlContextUser        = UMFactory.getUserFactory().getUser( Users[0] );
                         uwlContext.setUser            ( uwlContextUser );
                         Locale loc                  = new Locale( "ES" );
                         uwlContext.setLocale          ( loc );
                         HttpServletRequest request  = getHttpRequest();
                         uwlContext.setOriginRequest   ( request );
                         IUWLSession session         = uwlService.beginSession( uwlContext, sessionIdleTimeout );
                         uwlContext.setSession         ( session );
                         IUWLItemManager itemManager = uwlService.getItemManager( uwlContext );
                         QueryResult result          = itemManager.getItems( uwlContext, null, null );
                         users.put( String.valueOf( i ), uwlContext.getUserName() );
                         tasks.put( String.valueOf( i ), String.valueOf( result.getItems().size() ) );
                         uwlService.endSession( uwlContext );
                    int userTasks = 0;
                    int leastTasks = Integer.valueOf( tasks.get( 0 ) );
                    int userKey = 0;
                    for( int i = 0; i < Users.length; i ++ ){
                         userTasks = Integer.valueOf( tasks.get( Integer.toString( i ) ) );
                         if( userTasks < leastTasks ){
                              leastTasks = userTasks;
                              userKey = i;
                    return users.get( Integer.toString( userKey ) );
               else{
                    return "No users exist for this role";
          //Exception Handling
     private IUWLService findService() throws NamingException
          Properties properties = new Properties();
          properties.put( InitialContext.INITIAL_CONTEXT_FACTORY, "com.sapportals.portal.prt.registry.PortalRegistryFactory" ); 
          InitialContext ctx = new InitialContext( propiedades ); 
          IUWLService uwlService = ( IUWLService ) ctx.lookup( IUWLService.ALIAS_KEY );
          return uwlService;
     private HttpServletRequest getHttpRequest() throws Exception
          Properties properties = new Properties();
          properties.put( "domain", "true" );
          ApplicationWebServiceContext wsContext =
               (ApplicationWebServiceContext) new InitialContext( propiedades ).lookup( "/wsContext/" + ApplicationWebServiceContext.APPLICATION_WSCONTEXT );
          HttpServletRequest request = wsContext.getHttpServletRequest();
          return request; 

Hi David,
I have a similar requirement on our project. I need to get a count of pending workitems for all user but I'm getting similar message when I try to access UWL context of any other user.
Did you find any solution for this? Is it possible to get the workitems for all users using webservice or wendynpro?
I would appreciate if you can provide some inputs on this.
Thank you in advance.
Regards,
Seema Rane

Similar Messages

  • Getting UWL task count for all users in a role.

    Hi.
    I recently posted a question regarding a very similar issue, but I haven't got any response yet. I think my question might have been somewhat poorly phrased, so I will try to do better at explaining what we need.
    We have a number of processes, most of which need to be dynamically assigned to a user when created. The way we want to assign those tasks is by executing a WebService which would receive a role name and get all the users for that role. Then, using the UWL API, it would check how many tasks each of the users have in their UWL, and return the UserID for whoever has the least tasks. I haven't been able to get this to work. I keep getting Logged in users context or session doesn't exist Exception.
    Please, any help on this will be greatly appreciated.
    Currently working with SAP NWDS 7.1 SP05 PAT0005

    Hi,
    Thank you for your response, however, that's not what I need.
    For you and anyone esle who might find this extra info useful...
    I know how to get a user's role(s), and how to get the users in a role.
    I also know how to assign a task to a specific user dynamically.
    Using the UWL API, I know how to get the tasks (or items) in a user's UWL from a WD application, I need to do that from a WebService and using pretty much the same code, with the necessary adjustments, I can't get it to work.
    Furthermore, I'm able to get the UWL tasks for ONE user, that user being the one I log into the application with. For example, if I write code to get the tasks for user testUser1, I need to log in with testUser1 to get it to work, if I log in with any different user or make it a non-authenticated application, it won't work.
    Again, help on this is much needed and will be appreciated.

  • "expand role" nt waiting for all users in the role to view the notification

    I have created adhoc roles using the following code.
    lv_user_list_txt := 'SYSTECH'||','||'FNATECH';
    wf_directory.createadhocrole (lv_role_name_txt, lv_role_display_txt);
    wf_directory.adduserstoadhocrole (lv_role_name_txt, lv_user_list_txt);
    I have assigned it to the Item attribute of type 'Role' using the following code.
    wf_engine.setitemattrtext (
    itemtype => itemtype,
    itemkey => itemkey,
    aname => 'LIST_OF_APPROVER',
    avalue => lv_role_name_txt
    I have checked the 'Expand role' check box in the notification and assigned the performer as the Item attribute(Role type) 'LIST_OF_APPROVER'.
    But when one user in the role approves or rejects, the notification of the other user is cancelled. the other user can no longer view the notification.
    Ideally, after checking the 'Expand role', the workflow should not proceed to the next node until, all the user have performed an action. But this is not happening. Please help on this :(
    Thanks in Advance.
    Anitha.

    yes, I did. I spent at least 8 hours searching for a solution here, in the forums and tried everything making sense... The EFI downgrade was the only thing that helped.
    My personal opinion is: Apple should offer the EFI downgrade option to all users in an official way. It looks like my favorite vendor does not want to admit they made a hardware+software mistake (the EFI 1.7 update solves some HDD issues on some new MBPs but causes other problems on other MBPs).
    Message was edited by: Bartek Bargiel

  • Save for all users

    Hi,
    Is there a way to do "save for all users" automatically after export/import from the repository (macro maybe)?
    Thanks,
    Hubert

    Hi Hubert,
    Following information might help you resolve your query.
    The functionality you want has been already raised as an enhancement request.
    Unforunately we can save the report for all users through macros Automatically.
    ADAPT ID: ADAPT01161459
    Synopsis: Report should get saved for all users without checking the option u201CSave for all usersu201D.
    Regards,
    Sarbhjeet Kaur

  • Adding a domain user to the admin role within the local user management breaks all metro apps for all users!!

    Hi,
    I have posted this in another large thread under the "Windows 8 General" group but have not had any appropriate feedback from MS.
    After hours of testing and working with other users I have managed to isolate a simple situation that breaks all metro ui applications within Windows 8 for all users on the machine. Here are my exact steps and notes.
    Before continuing if you are running Avast then your solution may be to turn of the behaviour shield functionality as this also breaks metro apps. This is NOT the problem we are having!
    I have performed 3 cleans installs after isolating the problem and am able to reproduce the issue every time using the same steps on two different machines. 
    First thing to say is that for us it has nothing to do with simply joining the domain, domain/group policies nor does it appear to have anything to do with the software we installed, the problem here is much more simple but the result is pretty terrible.
    Here are my exact steps of what I did to reproduce our problem:
    Complete format of HDD in preperation for a clean install
    Clean install performed
    Set up the machine initially with a local account
    Test metro apps - all working fine
    Open control panel from the desktop, click on System, change the system to join the domain, click reboot
    Log into the system using my domain account
    Test metro apps - all working fine
    Here's were the problem starts. I need my domain account to have admin rights on the local machine so I can install programs without the IT men having to come over and enter their password every 5 mins.
    I go to control panel via the desktop and click on User Accounts. From with here I then click on "Manage User Accounts". This requires the IT guys to enter their details to give me access to such functionality. This is fine
    In the dialog box that opens I can only see the local user that was initially created during setup. The "Group" for this local account shows as "Administrators" - Image included below (important to note that metro apps are working at this point)
    I click add and then add my domain account - also giving it administrator access
    Sign off or reboot to ensure the new security is applied
    Sign back in to the domain account
    Test metro - ALL BROKEN
    Sign out
    Sign in as local account
    Test Metro - NOW ALL BROKEN FOR THIS USER ALSO
    So as soon as I add my domain account to the local user accounts and set it as admin it breaks all metro apps for all users. This is on a totally clean install with nothing at all installed other than the OS.
    Annoyingly if I go back and change the domain account to a standard user or if I totally remove the domain account from the local account management system the problem does not go away for either user. basically it is now permanently broken. The only fix I
    could fathom was a full re install and not giving the domain user admin access to the local  machine.
    Screen one - this is the local user accounts window AFTER joining the domain and logging in with my domain account (All metro apps working at this point)
    Screen 2: User accounts AFTER joining the domain and AFTER adding domain account to local user management (METRO BROKEN)
    I have isolated my machine from all group policies so nothing like that is affecting me. Users I have spoken to in different companies have policies that automatically add users to the local user management. This means that metro apps break as
    soon as they join the domain which leads them to wrongly think it is group policies causing the error. Once they isolate themselves from this they can reproduce following my steps.
    Thanks

    Hi Juke,
    Thank you for the response and apologies for the delay in getting back to you. My machine was running a long task so I couldn't try your suggested solution.
    I had already tried running the registry merge suggested at the top of the thread to no avail. I had not tried deleting the OLE key totally so I did that and the problem still exists. I will post all the errors I see in event viewer below. For
    your info, since posting my initial comment I have sent out my steps to 7 different people and we can all reproduce the problem. This comes to 10 different machines (3 of them mine then the other guys) in 3 different businesses / domains. We see the same errors
    in event viewer.
    Under "Windows Logs" --> "Application" : I get two separate error events the first reads "Activation of app winstore_cw5n1h2txyewy!Windows.Store failed with error: The app didn't start. See the Microsoft-Windows-TWinUI/Operational log for additional
    information." The second arrives in the log about 15 seconds after the first and reads "App winstore_cw5n1h2txyewy!Windows.Store did not launch within its allotted time."
    Under "Windows Logs" --> "System" : I get one error that reads "The server Windows.Store did not register with DCOM within the required timeout."
    Under "Applications And Services Logs" --> "Microsoft" -->  "Windows" --> "Apps" --> "Microsoft-Windows-TWinUI/Operational" : I get one error that reads "Activation of the app winstore_cw5n1h2txyewy!Windows.Store for the
    Windows.Launch contract failed with error: The app didn't start."
    If you require any further information just let me know and I will provide as much as I can.
    Thanks

  • Hi, While installing XQuatrz-2.7.7, the installation blocks at the "destination" level. It asks how to install this soft, "Install for all users" is shadowed, but frozen: i cannot select anything and move on. Any idea how to get that fixed? Thanks!

    Hi,
    While installing XQuatrz-2.7.7, the installation blocks at the "destination" level. It asks how to install this soft, "Install for all users" is shadowed, but frozen: i cannot select anything and move on. Any idea how to get that fixed?
    Thanks!

    It says above 2 relevant and 1 correct answere available .............
    I'm new here so could anyone direct me to these answeres?

  • Task List URL (to FR Report) opens in new window, but not for all users!

    Hi all,
    I am not sure if this is the correct forum to ask the question (for me it looks like an IE topic), but perhaps anybody can help me anyway...
    In one of our Planning apps (9.3.1) we defined several task lists and tasks that link to relevant FR Reports (URL Tasks). If I open the URL task in basic view the relevant FR Report opens in the same IE Window (in the main frame of the planning app). If my colleague opens the same task the FR Reports opens in a new IE Window.
    My problem is that I dont have any ideas where I can set the relevant property. Is that a planning property, a workspace property or an IE property setting??? Where can I adjust the settings that for ALL users the URL opens the Report in the same window??????
    Thanks in advance!!!!
    Kind Regards
    André
    P.S.: We are on IE8.

    Have you both got the same settings in Tools > Internet Options > Tabs Settings
    There was also a bug though I can't say if it is related to your issue
    9549216 - Instead of a new tab, a new window is displayed after you create a Financial Reporting task in Workspace.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Changes like password and removal of roles for all users

    Hi
    i want to change password for all users and remove single roles from all users.When i am doing this in SU10 changes are not reflecting for users.Please help reg this
    Vinod

    Me too...I have never been able to remove roles from multiple users with SU10.  I don't know if it's a bug or (more likely) just a confusing screen, but in 4.7 it never worked for me.

  • How do I get the HDD to show on the desktop for all users?

    I have found it by going to finder and preferences and show hard disks, but when another user logs in, it doesnt show. The Macs are networked and login using Active Directory, but as soon as I change the logon it doesnt show anymore.
    I need this to show or a network share using SMB to be mapped for all users when they logon. I have software "Read and Write Gold 4 for Mac" and upon starting the software, it needs to look for a license file. I can either copy to all the Macs, or have one on a network share.
    Any ideas welcome.

    Looking around, it seems that some people have changed the Launchpad key and want to go back.
    If there's a way to go back, then there must be a way to change it completely?
    In this thread, Fabien says that if you enter
    rm ~/Library/Preferences/com.apple.symbolichotkeys.plist
    into Terminal, you can bring the Launchpad key back.

  • I am trying to get Menu Editor 1.2.7 to work globally for all users. I have added the .xpi to the extensions folder and it is not being installed auto-magically.

    I would like to have Menu Editor installed for all users. I attempted to put the .xpi file in c:\Program Files (x86)\Mozilla Firefox\extensions with the expectation that the user would be prompted to install.

    You need to rename the XPI file to the (GU)ID of the extension as listed in the file install.rdf or just install the extension in a profile and copy the file or folder from that profile to the extensions folder.

  • Issue: workitem getting forwarded to all users sap inbox

    hiiii sap gurus
    i have created  workflow for PO RELEASE using the sap Standard workflow given,
    my problem is that the workitem is getting forwaded to all users. i have used custom Rule for agent determination and made the task as general task.
    Is this problem because the task is general task. please respond as this porblem is in Prd .
    Thanks ,
    Pradeep

    Hi Pradeep,
    I guess when you are already using a rule to determine the agents then you should not make the task as a General task.
    Change the task agent assignment to general forwarding not allowed. Then assign the rule to the task to determine the agents for the task.
    Now if the correct agents are not determined by the Rule then the workflow would result into error but not go to other users.
    You can check if the rule is working well using the Simulate button in PFAC.
    Also mark the 'Terminate If Rule Resolution Without Result' flag to stop the workflow there is an error occurs.
    Hope this helps¨!
    Regards,
    Saumya

  • Parties Invovled getting shuffled for soem users in campaign element

    Hi Experts,
    I am facing a very starnge issue here.Request you to kindly help me out.
    When i am trying to create a new camapaign element , partner functions employee responsible and created by does not get copied correctly. Only after the first refresh of the screen , it appears correctly in the parties involved assignment block.
    But after the next refresh of screen,it gets shuffled and if i try to enter new pfcts into the assignment block, it automatically replaces the pfcts to some other in the drop down(most cases to the first one from the drop down list ).
    Please help me  out if you have any idea why is this happening.
    This behavior does not happen for all user ids, but for some. For some,it is working fine in the same system,as expected with no issues.
    So i suspected authorization issues (role/profiles?) , but even after creating a new user id as a copy of the working user id, the new ones does not work .
    Please help ...appreciate your help...
    Thanks In advance
    Swapna.

    SAP note.

  • Want Central Goods Recipient for all users

    Hi All,
    We want to manitain Central Goods Recipient for all users, now the Recipient is the Goods reciever.
    How will we do configuration for this.
    We have 5 users in one Org. Unit, how we will make one as default.
    Thanks
    Ravi

    Satish,
    I did not quite get what you are trying to say.Could you please be more detailed.The below is my requirment and we are on ECS.
    I want to have a specific user as the central goods receipent.This user must be able to confirm goods and services for PO's created by all other users in that organization.
    My understanding from this thread is that,this can be achived by assigning the role "SAP_BBP_STAL_RECIPIENT",to that user and that user will be able to confirm goods and services for all PO's created by other user also.I tried to do the same and expected to see all PO's created by all other users when i click "Confirm Goods/Services centrally" .
    Thanks

  • Discoverer report been refreshed for all users

    Hi,
    We have created few reports in discoverer. These reports are been ported on to the portal.
    Totally there are almost 30 portal users. The problem i am facing is the report gets refreshed for all the portal users, due to which we are facing the performing issue. How can restrict a specific report which will refresh only for few users and not for all 30 portal users
    Thanks in advance
    Vishwanath

    Generic, try create as many discoverer portlets as type of refresh you need. and grant access on this portlets for appointed users

  • How to restrict login for multiple users having same Role

    Our Web Application is deployed on Tomcat 5.5
    The requirement is ?
    There are roles in application like "operator", "admin"?
    There are multiple users created for each of the above role.
    When one user of "operator" role is logged in, then
    It should not allow to login for another user of "operator" role.
    Also, if user did not log out & application gets close, then
    It should not allow to login for another user of "operator" role.
    Also, it should not allow to login for multiple requests of same user
    (using another browser instance...)
    Is it possible using session object?
    But, using session object, it will create separate objects for different users,
    So here I will not be able to restrict session object creation rolewise.
    Also, how to retrieve these multiple session objects created for different users on server?
    If anyone is having the solution please reply as soon as possible,
    Thank you.

    To tell you the truth, this is a stupid requirement. It must be an extremely fragile application.
    In any case, you will have to write your stuff for that. Probably a filter that on login, logout, and session expiration checks, makes, or removes entries in a DB (using a synchronized resource to prevent race conditions) or possibly even simply in an application context object.

Maybe you are looking for

  • Interface Error Handling

    Hi Experts, I am doing an Interface, Journal Upload for Transaction FB01 (F-65). I have to check the following ERROR Handlings. 1. How can I find out a profit Centres is blocked for posting? 2. How can I find out a GL Accounts are blocked for posting

  • File Adpater: Size of your processed messages

    Hi, i opened yesterday a thread aboud performance of file adapter, but i didn't get a satisfieing answer. So please give me following information: What was the biggest size of message which was processed by your file adapter? Every answer is welcome,

  • I cannot deactivate Adobe Photoshop Elements 10

    Ok, so I bought Adobe Photoshop Elements 10 and Adobe Premiere Elements 10 (both in the same case) from Fry's Electronics. I used to use another computer and so all my programs were there. But that was a shared computer, and now I have my own and red

  • 5d mark ii

    My computer doesnt show my 5d mark ii when i plug it in. I can uplaod photos from aperture and light room, but according to my computer there is no sign of the 5d mark ii being plugged in, i cant get my movie files off of it

  • HIDE STATEMENT IS MUST OR NOT FOR INTERACTIVE REPORT

    HI,   IN Interactive Report : without using the hide statement we will made the interactive report? and hide statement do its job after every increase of the sy-lsind please explain..          thanks            margani