# Transform to create Email & check for unique value

**URL:** <https://developer.sailpoint.com/discuss/t/transform-to-create-email-check-for-unique-value/100672>\
**Category:** SHF Discussion and Questions\
**Tags:** identity-security-cloud\
**Created:** [February 11, 2025, 12:55pm UTC](https://developer.sailpoint.com/discuss/t/transform-to-create-email-check-for-unique-value/100672 "2025-02-11T12:55:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohitmisal45](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/rohitmisal45/32/34069_2.png) [@rohitmisal45](https://developer.sailpoint.com/discuss/u/rohitmisal45)\
**Post date:** [February 11, 2025, 12:55pm UTC](https://developer.sailpoint.com/discuss/t/transform-to-create-email-check-for-unique-value/100672/1 "2025-02-11T12:55:15Z")

</div>

Hi,

I am working on creating a transform in SailPoint IdentityNow to generate an email address for identities where the **mail** attribute is null. The email format I need to generate is: [firstname.lastname.uniquecounter@domain.com](mailto:firstname.lastname.uniquecounter@domain.com).

I am using the `firstValid` operation in the transform, and identities with an existing mail attribute are correctly getting their email based on the account attribute. But, I am stuck when the **mail** attribute is null.

Additionally, I need to apply a condition based on the **number** attribute to generate the correct domain:

For number= 10, the domain should be _@abc.com_.  
For number=20, the domain should be _@xyz.com._

After generating the email for those with a **null mail** attribute, I need to ensure that the generated email doesn’t already exist with any other account (i.e., it should be unique). How can I check if the generated email already exists in the system before assigning it?

Could anyone help with how to handle the null **mail** case, apply the conditional logic for the domain based on **number** , and check the uniqueness of the generated email?

Thanks

---

<div class="post-metadata">

**Author:** ![Abhinov7](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/abhinov7/32/13253_2.png) [@Abhinov7](https://developer.sailpoint.com/discuss/u/Abhinov7)\
**Post date:** [February 11, 2025, 2:23pm UTC](https://developer.sailpoint.com/discuss/t/transform-to-create-email-check-for-unique-value/100672/2 "2025-02-11T14:23:52Z")

</div>

Hi,

You cannot check uniqueness with a transform. You need to create identity attribute rule.

Below is the documentation of same. Please review.

> **[Identity Attribute Rule | SailPoint Developer Community](https://developer.sailpoint.com/docs/extensibility/rules/cloud-rules/identity-attribute-rule)**
>
> This rule calculates and returns an identity attribute for a specific identity.

-Abhinov

---

<div class="post-metadata">

**Author:** ![Santhakumar](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/santhakumar/32/17329_2.png) [@Santhakumar](https://developer.sailpoint.com/discuss/u/Santhakumar)\
**Post date:** [February 12, 2025, 8:11am UTC](https://developer.sailpoint.com/discuss/t/transform-to-create-email-check-for-unique-value/100672/3 "2025-02-12T08:11:44Z")

</div>

If you generating the email for new users in target source please go with Attribute Generator rule. Below is the documentaion pls review and proceed with your code here.

> **[Account Profile Attribute Generator | SailPoint Developer Community](https://developer.sailpoint.com/docs/extensibility/rules/cloud-rules/account-profile-attribute-generator)**
>
> This rule generates complex account attribute values during provisioning, e.g. when creating an account.

---

<div class="post-metadata">

**Author:** ![gourab](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gourab/32/18650_2.png) [@gourab](https://developer.sailpoint.com/discuss/u/gourab)\
**Post date:** [February 12, 2025, 9:08am UTC](https://developer.sailpoint.com/discuss/t/transform-to-create-email-check-for-unique-value/100672/4 "2025-02-12T09:08:52Z")

</div>

I believe this is similar requirement to this post , please check this if it solves the use-case: [How can I generate a identity attribute only on identity creation? - #2 by iamnithesh](https://developer.sailpoint.com/discuss/t/how-can-i-generate-a-identity-attribute-only-on-identity-creation/14541/2)

---

<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:** [April 13, 2025, 9:09am UTC](https://developer.sailpoint.com/discuss/t/transform-to-create-email-check-for-unique-value/100672/5 "2025-04-13T09:09:22Z")

</div>

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