How to run existing advance search (with parameter) using SDK API

Hi All,

I want to run parmeterize advance search which saved at global seraches/workflow searches/(my search name).

but i am unable to give correct form of input parameter that leads to wrong output as a result.

Please check below code:-
I have tried different-2 way to give input parameters but can’t  figure it out yet.

IQuery query10 = (IQuery) AgileUtility.iAgileSession.getObject(IQuery.OBJECT_TYPE,
“/Global Searches/Workflow Searches/ChangeNewSearch”);
query10.setCaseSensitive(false);
HashMap mypar = new HashMap();

// NOT WORKS
mypar.put(IUserGroup.OBJECT_TYPE,UserGroupConstants.CLASS_USER_GROUP);
mypar.put(UserGroupConstants.ATT_GENERAL_INFO_NAME, “Change Analyst – ECMS”);
 query10.setParams( new Object[] { “1”,mypar});
//query10.setParams(new Object[] {UserGroupConstants.ATT_GENERAL_INFO_NAME, “Change Analyst – ECMS”});
//query10.setParams(new Object[] {“1”, “Change Analyst – ECMS”});
//query10.setParams(new Object[] {“Change Analyst – ECMS”});

Iterator iter10 =query10.execute().iterator();
while (iter10.hasNext()) {
IRow row = (IRow) iter10.next();
HashMap rowMap = new HashMap();
IChange changeobj = (IChange) row.getReferent();
// IProgram program=(IProgram)row.getReferent();
// program.getId();
changeobj.getId();
// String number=program.getName();
String number = changeobj.getName();
String name = (String) changeobj.getCell(
ChangeConstants.ATT_COVER_PAGE_NUMBER).getValue();
System.out.println(number);
}

Add Comment
2 Answer(s)

Hi All,

Thanks for viewing but after struggling and try all permutation and computation …Now its work for me.

For your reference if anyone will require same thing in future i am updating my working code here.

ArrayList<String> UserGroupList = new ArrayList<String>();

// Initialize your usergrouplist here

IQuery query10 = (IQuery) AgileUtility.iAgileSession.getObject(IQuery.OBJECT_TYPE,

query10.setCaseSensitive(false);
HashMap mypar = new HashMap();

query10.setParams(new Object[] {QueryConstants.PARAM_LIST_ELEMENT_CLASS,IUserGroup.OBJECT_TYPE});
query10.setParams(new Object[] {UserGroupList});

Iterator iter10 =query10.execute().iterator();
while (iter10.hasNext()) {
IRow row = (IRow) iter10.next();
HashMap rowMap = new HashMap();
IChange changeobj = (IChange) row.getReferent();

changeobj.getId();
// String number=program.getName();
String number = changeobj.getName();
String name = (String) changeobj.getCell(
ChangeConstants.ATT_COVER_PAGE_NUMBER).getValue();
System.out.println(number);
}

Agile User Answered on June 18, 2019.
Add Comment

Hi Priyanka,

 

How to execute custom basic search from Agile SDK ??

 

Agile User Answered on May 16, 2023.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.