cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get a SailPointObject by either id or object name

How to get a SailPointObject by either id or object name

In a custom workflow or rule, if you do not know if the return value from a call is the object name or id, then the getObject method from the Resolver interface can help you.

 

<T extends SailPointObject> T getObject(java.lang.Class<T> cls, java.lang.String idOrName) throws GeneralException

Retrieve an object by id or name.

 

e.g.

 

import sailpoint.object.*;

import sailpoint.api.*;

 

Identity identity = null;

 

identity = context.getObject(Identity.class,"2c9089c83e47e6f2013e47e8374a00b1");

System.out.println(identity.getDisplayName());

 

Prints "The Administrator"

 

identity = context.getObject(Identity.class,"spadmin");

System.out.println(identity.getDisplayName());

 

also prints "The Administrator"

Labels (1)
Comments

How do I can call the object dynamically or by requestor attributes ? Do we have any other way without using the Object name and Object id.

Take a look at the Filters and Filter Strings.pdf white paper.  Read the information about QueryOptions in it -- that is how you specify a lookup based on whatever attribute you have.

Version history
Revision #:
2 of 2
Last update:
‎Aug 02, 2023 08:46 PM
Updated by: