Thursday, 13 November 2014

Search Work Item in Roaster (PE API)

//Search Work Item in Roaster


public static VWWorkObject getVWWorkObject(VWSession peSession,String rosterName){
      VWWorkObject vwwObj=null;
      try{
     
     
          VWRoster roster=peSession.getRoster(rosterName);
          int queryFlags=VWRoster.QUERY_NO_OPTIONS;
          String abc = "abc";
          String filter="Property_Name ="+abc;

          //Change filter based on requirement

       
          VWRosterQuery query=roster.createQuery(null, null, null, queryFlags, filter, null, VWFetchType.FETCH_TYPE_WORKOBJECT);
          log.info("Total records for Work ITem: "+query.fetchCount());
         
          while(query.hasNext()){
              vwwObj=(VWWorkObject) query.next(); 
          }
         
      }catch(VWException vwe){
          log.error("Exception found at PEManager.getVWWorkObject():"+vwe,vwe);
          vwe.printStackTrace();
      }catch(Exception vwe){
          log.error("Exception found at PEManager.getVWWorkObject():"+vwe,vwe);
          vwe.printStackTrace();
      }
     
      return vwwObj;
  }

2 comments:

  1. please mention sample filter...here...
    I am getting error when I am filtering with Datafileds

    ReplyDelete