Which IIQ version are you inquiring about?
Version 8.1
Share all details related to your problem, including any error messages you may have received.
I am trying to iterate ApprovalItems and programmatically approve certain ones.
the test code below seems to update but not approve. the approval still shows up in the ui.
public void findAllApprovalWorkitems() throws Exception {
QueryOptions qo = null;
try {
this.context = this.getContext();
qo = new QueryOptions();
Filter filter = Filter.eq("type", "Approval");
qo.addFilter(filter);
Iterator it = context.search(WorkItem.class, qo);
if (it == null) {
System.out.println("ERROR:No Records");
return;
}
while (it.hasNext()) {
Object obj = it.next();
WorkItem wi = (WorkItem) obj;
String scheme = (String) wi.getAttribute("approvalScheme");
System.out.println("scheme:" + scheme);
ApprovalSet approvals = wi.getApprovalSet();
List<ApprovalItem> approvalItems = approvals.getItems();
for (ApprovalItem ai : approvalItems) {
System.out.println("Approver:" + ai.getAccountDisplayName());
System.out.println("Approver:" + ai.getApplicationName());
System.out.println("Approver:" + ai.getAssignmentId());
System.out.println("Approver:" + ai.getApprover());
System.out.println("Approver:" + ai.getAttributes());
System.out.println("Approver:" + ai.isApproved());
ai.approve();
System.out.println("Approver:" + ai.isApproved());
}
wi.setApprovalSet(approvals);
context.saveObject(wi);
context.commitTransaction();
}
} catch (Exception e) {
System.out.println("ERROR:" + e.getMessage());
e.printStackTrace();
throw e;
}
}
not sure if this is getting formatted
Thanks in advance