---
title: Check user existence
summary: Determines whether a requested user ID can be resolved in Active Directory, retrying with a SAIF-domain prefix if the first lookup fails.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.Security.SystemUser
reference_type: package
operation_id: OP-SU-08
trigger: Caller calls clsSystemUser.UserExists(inUserId)
---

# Check user existence

`UserExists` is a lightweight existence probe used before other operations (such as account creation) to determine whether a given user ID already has an Active Directory entry. It retries once with a `SAIF\` prefix if the bare user ID does not resolve.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-SU-08 |
| **Trigger** | Caller calls `clsSystemUser.UserExists(inUserId)` |
| **Inputs** | `inUserId` — the user ID to check |
| **Outputs** | `Boolean` result |
| **Primary components** | `clsSystemUser.UserExists(...)` |
| **Entry point** | `Business\SAIF.Business.Security.SystemUser\clsSystemUser.vb` |

## Steps

1. **Attempt the direct lookup.** `UserExists` calls `m_DirServer.GetUser(inUserId)`.
2. **Retry with a SAIF-domain prefix.** If the direct lookup returns `Nothing`, the method retries with `m_DirServer.GetUser("SAIF\" + inUserId)`.
3. **Evaluate existence.** `doesExist` is set to `True` if either lookup resolved a non-`Nothing` `clsUser` instance.
4. **Return the outcome.** The method returns `doesExist`.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Caller calls UserExists]) --> Direct[m_DirServer.GetUser inUserId]
	Direct --> DirectFound{Found?}
	DirectFound -->|Yes| Exists([Return True])
	DirectFound -->|No| Retry[m_DirServer.GetUser SAIF\ + inUserId]
	Retry --> RetryFound{Found?}
	RetryFound -->|Yes| Exists
	RetryFound -->|No| NotExists([Return False])
```

## Failure and edge-case behavior

- The `SAIF\` retry only helps when the caller's ID was passed without a domain prefix and the account actually resides in the `SAIF` domain; a user that only exists under a different naming form (e.g., a UPN or a differently prefixed form) will not be found by either lookup.*
- The method does not distinguish "user not found" from any underlying lookup error — both `GetUser` calls are assumed to return `Nothing` on failure rather than throwing.*

## Related documentation

- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

## Sources

- `Business\SAIF.Business.Security.SystemUser\clsSystemUser.vb`
