# idn.getFirstAccount returning null value

**URL:** <https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153>\
**Category:** SHF Discussion and Questions\
**Tags:** transforms, apis, identity-security-cloud, rules\
**Created:** [May 28, 2024, 1:42pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153 "2024-05-28T13:42:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jolan](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jolan](https://developer.sailpoint.com/discuss/u/jolan)\
**Post date:** [May 28, 2024, 1:42pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/1 "2024-05-28T13:42:06Z")

</div>

Hi,

I have a generic rule where part of the code, idn.getFirstAccount method is used for searching for existence of an account for an identity.

Reconfirm that the parameter value for “applicationName” format is end with “[source]”?

I am facing an issue where this method always return null to me. I am not sure if the applicationName is right or wrong.

How could I verify the applicationName value is correct? I could not see in source details in API shows the name ends with “[source]”

This is a sample of the code.

```auto
String my_AD = "THISISMY-AD";
sailpoint.rule.Identity identity = idn.getIdentityById(uid);
String identityName = identity.getName();

String myAppName = my_AD + " [source]";
Account nhgAccount = idn.getFirstAccountmyAppName, identityName);
if (null != nhgAccount) {
   newValue = concatenateString(newValue, acc);
}

```

---

<div class="post-metadata">

**Author:** ![sauvee](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sauvee/32/23601_2.png) [@sauvee](https://developer.sailpoint.com/discuss/u/sauvee)\
**Post date:** [May 28, 2024, 2:45pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/2 "2024-05-28T14:45:34Z")

</div>

The name “[source]” should be dropped as far as I’m aware. This is not needed in rules and such.

---

<div class="post-metadata">

**Author:** ![bhaskar-kancherla](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@bhaskar-kancherla](https://developer.sailpoint.com/discuss/u/bhaskar-kancherla)\
**Post date:** [May 28, 2024, 2:54pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/3 "2024-05-28T14:54:23Z")

</div>

> [@jolan](#):
>
> `myAppName `

You need to have the application name appended with [source]. We have a before provisioning rule where we need to append [source]

---

<div class="post-metadata">

**Author:** ![ipobeidi](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ipobeidi/32/16000_2.png) [@ipobeidi](https://developer.sailpoint.com/discuss/u/ipobeidi)\
**Post date:** [May 28, 2024, 3:20pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/4 "2024-05-28T15:20:18Z")

</div>

Actually you still need , as the “connector” on the IIQ running in the BG is creating with the [source].

@jolan , the application value is correct. what you can do to check is create a attribute in the Provisioning police and putting the ruel transform to return the value directly.

---

<div class="post-metadata">

**Author:** ![jolan](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jolan](https://developer.sailpoint.com/discuss/u/jolan)\
**Post date:** [May 28, 2024, 3:25pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/5 "2024-05-28T15:25:16Z")

</div>

If that the case, not sure why it’s still return null. Could be IdentityName? How do I verify if identity.getName() is same value as the identityName for the account?

---

<div class="post-metadata">

**Author:** ![ipobeidi](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ipobeidi/32/16000_2.png) [@ipobeidi](https://developer.sailpoint.com/discuss/u/ipobeidi)\
**Post date:** [May 28, 2024, 3:38pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/6 "2024-05-28T15:38:54Z")

</div>

The “identityName” is the Attribute you define as ID on the authoritative source.

It could be it.

---

<div class="post-metadata">

**Author:** ![jolan](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jolan](https://developer.sailpoint.com/discuss/u/jolan)\
**Post date:** [May 28, 2024, 4:00pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/7 "2024-05-28T16:00:40Z")

</div>

Hi Ivan,

Do you mean that identity.getName() is referring to the technical name of (uid) in the identity profile in this case?

How about identity.getUid() in this case?

---

<div class="post-metadata">

**Author:** ![ipobeidi](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ipobeidi/32/16000_2.png) [@ipobeidi](https://developer.sailpoint.com/discuss/u/ipobeidi)\
**Post date:** [May 28, 2024, 4:04pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/8 "2024-05-28T16:04:01Z")

</div>

No, the Identity Name is not UID, the identity name is the attribute you defined in the HR Source/Authorative source schemma as the ID or unioque attribute.

---

<div class="post-metadata">

**Author:** ![jolan](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@jolan](https://developer.sailpoint.com/discuss/u/jolan)\
**Post date:** [May 28, 2024, 4:23pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/9 "2024-05-28T16:23:34Z")

</div>

Thanks for the clarifying. Pardon me, last question. In this case, is identityName parameter in idn.getFirstAccount method also referring the account id attribute defined for the source?

---

<div class="post-metadata">

**Author:** ![ipobeidi](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/ipobeidi/32/16000_2.png) [@ipobeidi](https://developer.sailpoint.com/discuss/u/ipobeidi)\
**Post date:** [May 28, 2024, 5:22pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/10 "2024-05-28T17:22:02Z")

</div>

Yeah, you need to pass the “identity” attribute of the source you want to capture the account from.

Not sure about this method

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 27, 2024, 5:22pm UTC](https://developer.sailpoint.com/discuss/t/idn-getfirstaccount-returning-null-value/58153/11 "2024-07-27T17:22:16Z")

</div>

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