Saturday, May 1, 2021

How to remove Workgroups for the user?

import java.util.ArrayList;

import java.util.List;

import sailpoint.object.Identity;

import sailpoint.api.SailPointContext; 

import sailpoint.tools.GeneralException;


public void removeWorkGroupsAssignment(String name) throws GeneralException{

String methodName = "removeWprkGroupAssignment";

log.debug("Entering into the method : "+methodName);


Identity identityObj = context.getObject(Identity.class, name);

List<Identity idWorkGroups = new ArrayList<Identity>();

idWorkGroups = identityObj.getWorkgroups();


for(Identity workGoup : idWorkGroups){

identityObj.remove(workGoup);

context.saveObject(identityObj);

context.commitTansaction();

}

log.debug("Exiting from the method : "+methodName);

}

No comments:

Post a Comment

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...