Update to default owner

I need to check if azure (obj) has it owner or not before changing it to default. Because if obj has owner i need to change accountgroup owner same as obj owner and only if both are null then only change to default owner.


import sailpoint.object.*;


Identity defaultOwner = context.getObjectByName(Identity.class, "Azure Default Owner");
Identity currentOwner = accountGroup.getOwner();
String displayName = accountGroup.getDisplayName();

if (accountGroup.isRequestable()) {
    if (currentOwner == null && displayName != null && displayName.startsWith("AAD")) {
        accountGroup.setOwner(defaultOwner);
    }
} else {
    if (currentOwner == null && displayName != null && displayName.startsWith("AAD")) {
        accountGroup.setOwner(defaultOwner);
    }
}

return accountGroup;

@autorun6464

import sailpoint.object.*;


Identity defaultOwner = context.getObjectByName(Identity.class, "Azure Default Owner");
Identity currentOwner = accountGroup.getOwner();
String displayName = accountGroup.getDisplayName();

    if (currentOwner == null && displayName != null && displayName.startsWith("AAD")) {
        accountGroup.setOwner(defaultOwner);
    }
return accountGroup;

i think this will also do same. Or you want to be like that

Identity currentOwner = accountGroup.getOwner();
if(currentOwner != null) {
   accountGroup.setOwner(defaultOwner);
  return accountGroup;
} else {
   Identity defaultOwner = context.getObjectByName(Identity.class, "Azure Default Owner");
   String displayName = accountGroup.getDisplayName();

    if (displayName != null && displayName.startsWith("AAD")) {
        accountGroup.setOwner(defaultOwner);
    }
      return accountGroup;
}

Can you give me details ?

No i need ** obj owner
Identity currentOwner2= obj.getOwner();

But i not getOwner() is not working for obj

@autorun6464 it should be multi values attribute in azure : owners

accountGroup.getAttribute("owners"); // it will return mutilvalued.

now you can plan based on data. 

just wanna know if accountGroup owner and obj owner are always same???.. like i need to check if any of the have owners. isant accountGroup is saipoint side and obj is azure side

Yes, you are correct, accountGroup is sailpoint side and obj is target side. if you have owner in target apps then

Object owner = obj.getAttribute("owners"); // Or owner 
here you will get either String or List of owners from Azure

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.