# Username Generator transform issue when using inside conditional transform

**URL:** <https://developer.sailpoint.com/discuss/t/username-generator-transform-issue-when-using-inside-conditional-transform/97908>\
**Category:** SHF Discussion and Questions\
**Tags:** transforms, identity-security-cloud\
**Created:** [January 17, 2025, 3:34pm UTC](https://developer.sailpoint.com/discuss/t/username-generator-transform-issue-when-using-inside-conditional-transform/97908 "2025-01-17T15:34:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShireeshaC2024](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@ShireeshaC2024](https://developer.sailpoint.com/discuss/u/ShireeshaC2024)\
**Post date:** [January 17, 2025, 3:34pm UTC](https://developer.sailpoint.com/discuss/t/username-generator-transform-issue-when-using-inside-conditional-transform/97908/1 "2025-01-17T15:34:05Z")

</div>

Hi All,  
I just wanted to know that, whether we can use Username Generator transform inside any other transform like Conditional/static/firstValid, as we have an requirement to populate a static value and usernameGenerator value to the distinguished name based on condition, static value in the positive condition is getting populated correctly , however in the negative condition unique counter is not working in the username generator(kept usernameGenerator in negative condition).  
Any suggestions would be highly appreciated.

---

<div class="post-metadata">

**Author:** ![vasanthrajsp29](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/vasanthrajsp29/32/20713_2.png) [@vasanthrajsp29](https://developer.sailpoint.com/discuss/u/vasanthrajsp29)\
**Post date:** [January 17, 2025, 3:45pm UTC](https://developer.sailpoint.com/discuss/t/username-generator-transform-issue-when-using-inside-conditional-transform/97908/2 "2025-01-17T15:45:26Z")

</div>

Hi @ShireeshaC2024,

Yes we can do that. Username Generator is more likely to be used in create account profile while provisioning account where you can use conditional transform for taking decision.

-Vasanth

---

<div class="post-metadata">

**Author:** ![ShireeshaC2024](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@ShireeshaC2024](https://developer.sailpoint.com/discuss/u/ShireeshaC2024)\
**Post date:** [January 18, 2025, 7:59am UTC](https://developer.sailpoint.com/discuss/t/username-generator-transform-issue-when-using-inside-conditional-transform/97908/3 "2025-01-18T07:59:26Z")

</div>

Hi @vasanthrajsp29  
Thanks for the reply,  
I have developed a custom transform by including the usernamegenerator transform in the negative condition the problem with the transform is positive condition is working fine, but when comes to the negative condition unique counter is not working, tried creating users with same firstname and last name where it should check for uniquness and append numbers if already found, that is not working, giving the error as entry already exists. Can you please review the transform and let me know what I am missing here.

{  
“name”: “distinguishedName”,  
“transform”: {  
“type”: “conditional”,  
“attributes”: {  
“expression”: “$reh eq 1”,  
“reh”: {  
“type”: “firstValid”,  
“attributes”: {  
“values”: [  
{  
“attributes”: {  
“name”: “rehire”  
},  
“type”: “identityAttribute”  
},  
{  
“attributes”: {  
“value”: “NA”  
},  
“type”: “static”  
}  
]  
}  
},  
“username”: {  
“type”: “firstValid”,  
“attributes”: {  
“values”: [  
{  
“attributes”: {  
“name”: “adUsername”  
},  
“type”: “identityAttribute”  
},  
{  
“attributes”: {  
“value”: “NA”  
},  
“type”: “static”  
}  
]  
}  
},  
“ou”: {  
“type”: “lookup”,  
“attributes”: {  
“input”: {  
“attributes”: {  
“name”: “businessUnitCode”  
},  
“type”: “identityAttribute”  
},  
“table”: {  
“CU001”: “OU=xyz,OU=xyz”,  
“SS001”: “OU=xyz”,  
“HBA01”: “OU=xyz”,  
“DM001”: “OU=xyz”,  
“SL001”: “OU=xyz”,  
“STRYR”: “OU=xyz,OU=xyz”,  
“SEI01”: “OU=xyz”,  
“JRS01”: “OU=xyz”,  
“default”: “OU=xyz”  
}  
}  
},  
“positiveCondition”: {  
“type”: “static”,  
“attributes”: {  
“value”: “CN=$username,$ou,DC=xx,DC=xx”  
}  
},

“negativeCondition”: {

“type”: “usernameGenerator”,  
“attributes”: {  
“sourceCheck”: true,  
“patterns”: [  
“CN=$fi.$ln,$ou,DC=xx,DC=xx”,  
“CN=$fi.$ln${uniqueCounter},$ou,DC=xx,DC=xx”  
],  
“fi”: {  
“attributes”: {  
“begin”: 0,  
“end”: 1,  
“input”: {  
“attributes”: {  
“name”: “firstNameFormatted”  
},  
“type”: “identityAttribute”  
}  
},  
“type”: “substring”  
},  
“ln”: {  
“type”: “identityAttribute”,  
“attributes”: {  
“name”: “lastNameFormatted”  
}  
},  
“ou”: {  
“type”: “lookup”,  
“attributes”: {  
“input”: {  
“attributes”: {  
“name”: “businessUnitCode”  
},  
“type”: “identityAttribute”  
},  
“table”: {  
“CU001”: “OU=XXXX,OU=XXXX”,  
“SS001”: “OU=xyz”,  
“HBA01”: “OU=XXXX”,  
“DM001”: “OU=xyz”,  
“SL001”: “OU=xyz”,  
“STRYR”: “OU=xyz,OU=xyz”,  
“SEI01”: “OU=xyz”,  
“JRS01”: “OU=xyz”,  
“default”: “OU=xyz”  
}  
}  
}  
}  
}  
}  
},  
“attributes”: {  
“cloudMaxUniqueChecks”: “100”,  
“cloudMaxSize”: “100”,  
“cloudRequired”: “true”  
},

“isRequired”: false,  
“type”: “usernameGenerator”,  
“isMultiValued”: false  
},

---

<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:** [March 19, 2025, 8:00am UTC](https://developer.sailpoint.com/discuss/t/username-generator-transform-issue-when-using-inside-conditional-transform/97908/4 "2025-03-19T08:00:06Z")

</div>

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