How to get all accounts of a source in ISC

Hello mate,

I’m trying to fetch all accounts from a source for a usecase, and i have come through below method.
getAllAccounts(java.lang.String applicationName, java.lang.String identityName) from idnRuleUtil.

Does it return all accounts from a source if I provide null in the place of identityName.

Thanks
ISC Discussion and Questions

Hi @VenkatMannem13 ,

If you use getAllAccounts() method, you must need to give the identity name. This will return all the accounts which the given identity have.

Thank you @GOKUL_ANANTH_M for quick response.

Okay, is there any work around to get all accounts of a source. I’m trying to fetch recently created account’s employee number, so that i can increment it and return new employee number.

So, tell me if I have understood your use-case clearly.

On creation of user on an application, you are assigning an employee number. For that you are comparing the created employee number with all the other accounts. Am I right? Also, what’s the rule you are using for it?

I’m using IdentityAttribute Rule. Below is the pseudocode if it helps in understanding.

  1. Get all accounts from HR application
  2. Sort them based on creation date
  3. Get the recently created one and get Employee number
  4. Increment the employee number
  5. Check if it exists in AD, if not, return it on identity.
  6. It will be used later while AD account creation and write back the same to HR application

I am just thinking it on another way. As I can’t find anyway for getting all accounts from an application.

Even, once an account is going to be created in IDN, it’s going to calculate an Identity Attributes, where you are going to use this rule on creating Employee Number.

So, using the below snippet, you get the applicationName. This is because, to avoid getting values from identity attributes. Here, we use account attributes to calculate the values needed - best practise.

List links = identity.getLinks();
String applicationName, nativeIdentity;
String authoritativeSourceId = "" //HR App ID;

if (!Objects.isNull(links)) {
    for (Link link: links) {
        if (link.getApplicationId().equals(authoritativeSourceId)) {
            applicationName = link.getApplicationName();
            nativeIdentity = link.getNativeIdentity();
        }
    }
}

String firstName; //Initialize the variables you need

if (!Objects.isNull(idn.getAccountAttribute(applicationName, nativeIdentity, "First Name"))) {
    firstName = idn.getAccountAttribute(applicationName, nativeIdentity, "First Name");
}

/*
you can also use,
if (!Objects.isNull(identity.getAttribute("firstname"))) {
   firstName = identity.getAttribute("firstname");
}
This method can be avoided as this is going to be executed while creation itself.
*/

// After this you may give your condition to start the script.

I think this may help you. Thanks!!

1 Like

To check the created Employee Number is present in AD, you can use - IdnRuleUtil (attrSearchCountAccounts() method).

Sorry, that I missed to mention the employee number needs to be calculated during identity creation and the new number will be based on recently created identity’s employee number.

So, I need to fetch recently created account from the HR source.

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