Thursday, 02 January 2014 00:00

Getting a user's recently visited items

Written by 

I had a comment posted in another blog (Agile PX - Creating an Agile PLM Process Extension ) from Akshay who wanted to know how to get items from the Recently Visited and Navigator panes in the web client.  They figured out Recently Visited items, but not Navigator.  Navigator doesn't appear to be persisted, so there is little help I can offer, but I thought readers may be interested in knowing how to get the Recent items.

The process flow is pretty simple:

  • Get the IUser of interest
  • Get the recently visited IFolder
  • Iterate over the IAgileObjects in the IFolder

 

recent visits

 

Here's the Code

 

public static void main(String[] args) throws Exception {
        
        AgileSessionFactory factory = AgileSessionFactory.getInstance(agileURL);
        
        HashMap<Integer, String> params = new HashMap<Integer, String>();
        params.put(AgileSessionFactory.USERNAME, agileUsername);
        params.put(AgileSessionFactory.PASSWORD, agilePassword);
        session = factory.createSession(params);
    
        IUser me = session.getCurrentUser();
        IFolder folder = me.getFolder(FolderConstants.TYPE_RECENT_VISIT);
        ITwoWayIterator iterator = folder.getFolderIterator();
        
        IAgileObject visit;
        
        while (iterator.hasNext()) {
            visit = (IAgileObject) iterator.next();
            System.out.println(visit.getName());
        }
} 

 

Last modified on Friday, 14 July 2017 10:25
Rodney McCabe

Sr. Technical Consultant and Solution Architect at Mazamo Corp
http://www.linkedin.com/in/rodneymccabe