• 0 Votes
    4 Posts

    @Paul-Winterhalder Amazing! This is perfect for my needs-- thanks so much Paul.

  • Method to access "other user" items

    Solved General
    1 Votes
    2 Posts

    Hi Claudiu,

    It's possible to do this using cloud script... you just need to impersonate the other user...

    Here's an example script that does this - caveat, it only returns the first page of user items.

    Create the script, and set it's test parameters to:

    { "profileId": "www-xxx-yyy-zzzz-123456" }

    (Note - you'll of course want to replace profileId with an id of a user that you want to test with.)

    And here's the code...

    var response = {}; // We need to impersonate another user to make this call var otherSession = bridge.getSessionForProfile( data.profileId ); var otherUserItemsProxy = bridge.getUserItemsServiceProxy( otherSession ); // Now, request the page of items from that proxy var context = { "pagination": { "rowsPerPage": 50, "pageNumber": 1 }, "searchCriteria": {}, "sortCriteria": { "createdAt": 1 } }; var includeDef = true; var itemResult = otherUserItemsProxy.getUserItemsPage( context, includeDef ); if (( itemResult.status == 200) && ( itemResult.data.results.count > 0 )) { response.items = itemResult.data.results.items; } else { response.items = []; } response;

    For convenience I've attached an export of the script. You can import this script into your app from the Design | Cloud Code | Scripts screen.

    Hope that helps!



  • 0 Votes
    2 Posts

    Hmm, I'm guessing that this is so that you as a developer have a warning that you may be mucking with an online user's data?

    Sadly, unless the user is using RTT, the system doesn't deterministically know that a user is still online.

    We do however know when the user last logged in - and that is shown on the User Summary page here (see capture).

    You can further get an idea if a user is still online via the User Monitoring | Logs page...

    Might be interesting to see if we could query the last session for the time of the last received request... though we'd need to somehow differentiate a real session from an API Explorer session... Hmm, some food for thought.


  • 0 Votes
    2 Posts

    Just noticed this was never replied to!

    To clarify - our new Users API was delivered in 4.3 late last year.