Hi, everyone
I’m trying to provision a role to an identity and i’m using the following code:
Identity identity = context.getObject(Identity.class, "999999999");
String value = "FTI. Teste";
Bundle bundle = context.getObject(Bundle.class, value);
String type = "it";
String operation = "Add";
String application = "AD XPTO D";
String targetIdentityName = identity.getName();
String requesterIdentityName = "spadmin";
IdentityService identityService = new IdentityService(context);
Application CPUA = context.getObjectByName(Application.class, application);
List<Link> account = identityService.getLinks(identity, CPUA);
String nativeIdentity = (String) account.get(0).getNativeIdentity();
ProvisioningPlan plan = new sailpoint.object.ProvisioningPlan();
plan.setIdentity(identity);
ArrayList requesters = new ArrayList();
requesters.add(context.getObject(Identity.class, requesterIdentityName));
plan.setRequesters(requesters);
plan.setSource("LCM");
plan.setComments("Added by API");
AccountRequest acctReq = new AccountRequest();
acctReq.setApplication(application);
acctReq.setNativeIdentity(nativeIdentity);
acctReq.setOperation(AccountRequest.Operation.Modify);
AttributeRequest attributeRequest = new AttributeRequest();
if(operation.equals("Add"))
{
attributeRequest.setOp(ProvisioningPlan.Operation.Add);
}
else
{
attributeRequest.setOp(ProvisioningPlan.Operation.Remove);
}
attributeRequest.setValue(value);
attributeRequest.setName(type);
acctReq.add(attributeRequest);
plan.add(acctReq);
Provisioner provisioner = new Provisioner(context);
provisioner.execute(plan);
String msg = "";
TaskResult task = new TaskResult();
provisioner.saveResults(task);
ProvisioningProject project = provisioner.getProject();
List<Message> listMsgs = project.getErrorMessages();
if(!listMsgs.isEmpty())
{
for(Message listMsg : listMsgs)
{
msg = listMsg.getMessage();
}
}
return msg;
However i’m getting this error when i try to execute my code:
Error(s) reported back from the IQService - Failed to update attributes for identity CN=Luis Fernando, OU=Usuarios, OU=AdmCentral, DC=itaud, DC=des, DC=ihf. The specified directory service attribute or value does not exist.
I already checked the identity and their account exists, the role also exists.
Someone can help me to find what is wrong?