Username Generator

Hi All,

We have a requirement to create email for new users and write back to workday system, email pattern should (first latter of firstname + lastname + domain) I am able achieve this by below transform but problem is with {uniqueCounter} in username generator its starting with 1 even though the value is unique.

{
“name”: “EMAIL_ADDRESS_WORK”,
“transform”: {
“type”: “usernameGenerator”,
“attributes”: {
“sourceCheck”: true,
“patterns”: [
“$fi$ln${uniqueCounter}@domain.com
],
“fi”: {
“type”: “lower”,
“attributes”: {
“input”:{
“type”: “substring”,
“attributes”: {
“input”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “firstname”
}
},
“begin”: 0,
“end”: 1
}
}
}
},
“ln”: {
“type”: “lower”,
“attributes”: {
“input”: {

                                "type": "identityAttribute",
                                "attributes": {
                                    "name": "lastname"
                                }
                            }
                        
                    }
                }
            }
        },
        "attributes": {
            "cloudMaxSize": "100",
            "cloudMaxUniqueChecks": "25",
            "cloudRequired": "true"
        },
        "isRequired": false,
        "type": "string",
        "isMultiValued": false
    }

for this I’m getting [email protected], Looking for valuable suggestion.
Thanks!

Hi @vasanthrajsp29

Welcome to SailPoint Developer Community.

That wouldn’t be the case, are you sure that this email doesn’t exists, even under uncorrelated accounts ?

I hope you applied the transform at AD source.

Thanks
Krish

2 Likes

Hi @vasanthrajsp29.

Welcome to the SailPoint Developer Community :slight_smile:

With the username generator transform, you can define multiple patterns. If you don’t want the counter used initially, you should define your first pattern without the use of that variable. In the next pattern, you can add the unique counter. The generator will try the first pattern for uniqueness before moving on to the next.

This should work for you:

{
    "name": "EMAIL_ADDRESS_WORK",
    "transform": {
        "type": "usernameGenerator",
        "attributes": {
            "sourceCheck": true,
            "patterns": [
                "[email protected]",
                "$fi$ln${uniqueCounter}@domain.com"
            ],
            "fi": {
                "type": "lower",
                "attributes": {
                    "input": {
                        "type": "substring",
                        "attributes": {
                            "input": {
                                "type": "identityAttribute",
                                "attributes": {
                                    "name": "firstname"
                                }
                            },
                            "begin": 0,
                            "end": 1
                        }
                    }
                }
            },
            "ln": {
                "type": "lower",
                "attributes": {
                    "input": {
                        "type": "identityAttribute",
                        "attributes": {
                            "name": "lastname"
                        }
                    }
                }
            }
        }
    },
    "attributes": {
        "cloudMaxSize": "100",
        "cloudMaxUniqueChecks": "25",
        "cloudRequired": "true"
    },
    "isRequired": false,
    "type": "string",
    "isMultiValued": false
}

You can learn more information on the Username Generator transform here.

If this or another post solves your issue, please be sure to mark them as a solution so others reviewing this thread can easily find the guidance they need.

Edit: The unique counter will be not be included in first run, so the additional pattern is not necessary.

1 Like

Hi @MVKR7T,

Yes, you’re right it’s not working for all scenario’s what would be the right suggestion here?

Writing cloud rule to achieve this would help?

Thanks!
Vasanth

no need of a separate Transform even, just use Generator in Create Account Provisioning form.

Generator type is: Create Unique LDAP Attribute and use below pattern like this

$(firstname).$(lastname)$(uniqueCounter)

It did work for us.

Thanks
Krish

3 Likes

@MVKR7T Based on the attribute name, this doesn’t seem to be AD. Will Create Unique LDAP Attribute work?

@vasanthrajsp29 what is the target application?

Hi Krish,

Create Unique LDAP Attribute can we use this to build business logic email pattern should (first latter of firstname + lastname + domain) will it be possible?

Thanks!
Vasanth

Hi @bcariaga,

Its workday auth source.

Thanks!
Vasanth

Hi Vasanth,

As an alternate method, you can try to use the cloud rule. Please see the link below for an example.

1 Like

Below is the sequence of operations.

  1. You can have any value to the email identity attribute, it doesn’t need to be unique even. We can generate an email in a format

    [email protected]

    or any format, you don’t need to worry about uniqueness.

  2. I believe you use AD, generate email at create account with uniqueness using the Generator as I have mentioned already.

  3. You need to use FirstValid Transform for email attribute with below logic

  • Get email from your AD source
  • If not available, then generate using concat Transform
  1. Once AD account is created, Identity updates with the mail from AD account
  2. Enable attribute sync for you HR source using your mail attribute

Thanks
Krish

3 Likes

This is noted, Thanks Krish

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