How to create workitem in SailPoint

In this sailpoint tutorial examples post, we will see the code to create workitem in SailPoint manually.

Below is the code to create manually workitem in SailPoint for any specific application.

//create object of workitem
WorkItem item = new WorkItem();
item.setType(WorkItem.Type.ManualAction);
item.setOwner("set the owner");
Sequencer sequencer = new Sequencer();  
item.setName(sequencer.generateId(context, item));  
item.setRenderer("lcmManualActionsRenderer.xhtml");  
item.setLevel(WorkItem.Level.Normal);  
item.setTarget("target identity name");  
item.setTargetClass(Identity.class.getName());  
item.setDescription(itemDesc);  
item.setHandler("sailpoint.api.Workflower");  
item.setIdentityRequestId("put_identity_request_id");  


Attributes attributes = new Attributes();  
item.setAttributes(attributes);  
ApprovalSet approvalSet = new ApprovalSet();
ApprovalItem approvalItem = new ApprovalItem();  
approvalItem.setApplication("put_name_of_the_application);  
approvalItem.setNativeIdentity("put_target_identity_name");  
approvalItem.setOperation(operation);  
approvalItem.setValue(itemValue);  
approvalSet.add(approvalItem);
            
attributes.put("approvalSet", approvalSet);  
attributes.put("identityDisplayName", "put_display_name_of_target_identity");  
attributes.put("identityName", "put_target_identity_name");

context.startTransaction();  
context.saveObject(item);  
context.commitTransaction(); 

Copy the above code to create workitem in Sailpoint. please change the static value with the actual value.

Scroll to Top