In SailPoint IdentityIQ 8.4, is it possible to programmatically complete and archive a manual work item that was generated directly through code? Since these work items are not associated with an Identity Request or a WorkflowCase.
The work items behave normally in the UI — I can manually complete and archive them without any issues. However, I’m trying to implement a rule to automatically close aging work items from the backend. For that, I need a reliable way to reject and archive these code‑generated work items within a rule.
Has anyone implemented this successfully? Please advise.
can you try below rule, you can add filter as per your requirement. try this code, this should finish the workitem and put them in archive.
can you try below rule and see if it works for you?? Put filter according to your requirement.and also in identity configuration, inside workitems, See if you have selected manual Actions for archival.
Filter filter2 = Filter.eq("owner.name","ownername");
Filter filter3 = Filter.eq("requester.name","requestname");
QueryOptions qp = new QueryOptions();
qp.addFilter(Filter.and(filter2,filter3));
int size=0;
List workitems = context.getObjects(WorkItem.class,qp);
for(WorkItem wi: workitems)
{
if(wi.getType().toString().equalsIgnoreCase("Approval")){
wi.setCompletionComments("comment if needed");
wi.setCompleter("username");
wi.setState(WorkItem.State.Finished);
wi.addComment("Testing");
context.saveObject(wi);
Workflower flower = new Workflower(context);
flower.process(wi,false);
context.commitTransaction();
context.decache();
size++;
}
}
@Spoorthy_m You can use the sample code provided by @naveenkumar3 . This should mark your manual work items as completed. But to see them in WorkItemArchive, you need to allow archival in GlobalSettings → IdentityIQ Configuration → Workitems→ Work Item Archives → Select Manual Action, this should allow your manual work items to be stored in WorkItem Archive.
Please also share your code using which you are generating the manual workitems to review what type your are setting and what all attributes are available? This should allow us to recommend necessary filters to be part of the archival rule.