# Problem with username generator

**URL:** <https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402>\
**Category:** SHF Discussion and Questions\
**Tags:** transforms, provisioning, sailpoint-identity-security\
**Created:** [July 12, 2024, 10:06am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402 "2024-07-12T10:06:29Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 12, 2024, 10:06am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/1 "2024-07-12T10:06:29Z")

</div>

Good morning,

We are trying to create a “username generator” transformation for a provisioning policy with the aim of creating a unique alias during provisioning.

This is our first time doing it, and we simply tested uploading the policy code to the tenant using the ISC plugin for Visual Studio, and it uploads correctly:

 ![imagen](https://global.discourse-cdn.com/sailpoint/original/2X/4/4743b41b024470e17ff608ec800be36920cb84a5.png)  
 ![imagen](https://global.discourse-cdn.com/sailpoint/original/2X/7/7eecc6a8fef65dd8761fc51b96fa75b5b7190099.png)

The problem is that when importing identities, the code is partially erased:

![imagen](https://global.discourse-cdn.com/sailpoint/original/2X/3/380d69820deba304690b5411996310b9e9259276.png)

and does not do what it should (it’s a test where it should simply add an @ + lastName). Is there something we are doing wrong?

Thanks!

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [July 12, 2024, 10:17am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/2 "2024-07-12T10:17:29Z")

</div>

You might be experiencing this BUG: [Bug - Create Account Provisioning Policy - Feedback / Bugs - SailPoint Developer Community](https://developer.sailpoint.com/discuss/t/bug-create-account-provisioning-policy/67948)  
That if you go back into the GUI and make a change, the code disappears from VSC.

Phil

---

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 12, 2024, 10:26am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/3 "2024-07-12T10:26:27Z")

</div>

@PhilRawlings1 thank you very much for the response, it seems that the problem is indeed exactly that, and it is something recent that the technical support team is trying to resolve. We hope it gets fixed as soon as possible.

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [July 12, 2024, 10:28am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/4 "2024-07-12T10:28:43Z")

</div>

Hi @smenendezp ,

If you just doing everything via VSC and don’t go back into the GUI, then you will be okay to continue with your development/testing

---

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 12, 2024, 11:02am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/5 "2024-07-12T11:02:15Z")

</div>

Alright, we are testing this and now it doesn’t get erased, but it still doesn’t display what we want. According to the first photo I uploaded to this thread, it should show the text “@[corresponding\_lastName]” in the displayName value, right? Because it still doesn’t show it.

Thank you very much, @PhilRawlings1 !

---

<div class="post-metadata">

**Author:** ![sushantkulkarni](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sushantkulkarni/32/35213_2.png) [@sushantkulkarni](https://developer.sailpoint.com/discuss/u/sushantkulkarni)\
**Post date:** [July 12, 2024, 11:54am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/6 "2024-07-12T11:54:59Z")

</div>

Hey @smenendezp  
Aren’t you trying to generate this alias to be unique? Perhaps you may want a counter at the end of the last name in scenarios where 2 or more people have the same last name.

Why don’t you give this a try:

```auto
{
  "name": "Alias_test",
  "transform": {
    "type": "usernameGenerator", 
    "attributes": {
      "patterns": [
        "$ln${uniqueCounter}"
      ],
      "ln": {
        "type": "identityAttribute",
        "attributes": {
          "name": "lastName"
        }
      }
    }
  },
  "attributes": {
    "cloudMaxSize": "100",
    "cloudMaxUniqueChecks": "9",
    "cloudRequired": "true" 
  },
  "isRequired": true,
  "type": "string",
  "isMultiValued": false
}

```

---

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 12, 2024, 12:39pm UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/7 "2024-07-12T12:39:11Z")

</div>

Hello, @sushantkulkarni

Indeed, my intention is to do something more complex, but first I wanted to try something simple to see if I was doing it correctly. As mentioned above, there is a reported error. We will try to perform tests and gradually increase the complexity of what we need, working exclusively from ISC Visual Studio to avoid the error until it is fixed by SailPoint.

Thank you!

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [July 12, 2024, 1:11pm UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/8 "2024-07-12T13:11:00Z")

</div>

@smenendezp

Is there an attribute called “Alias\_test” on the source that you are creating?  
Because that is what you are trying to populate with this transform.

Phil

---

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 12, 2024, 2:55pm UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/11 "2024-07-12T14:55:59Z")

</div>

No, but I was associating it with the “displayName” attribute in the graphical interface (it’s associated, I didn’t go back in and the error that erased the code didn’t occur again). I assumed that the value of what I am trying would appear in the “displayName” attribute:

![7eecc6a8fef65dd8761fc51b96fa75b5b7190099_2_517x301](https://global.discourse-cdn.com/sailpoint/original/2X/5/503946e56a718a051e12b2dc068fa23661a2c703.png)

This is my first time doing this, so I am learning. I am going to change “Alias\_test” to an attribute that exists to see if it changes as I want.

Thanks again, @PhilRawlings1!

---

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 12, 2024, 2:56pm UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/12 "2024-07-12T14:56:57Z")

</div>

I have tried it and it doesn’t work, maybe I am doing something wrong by doing it from the ISC plugin of Visual Studio. I set the name to “cloudLifecycleState,” which is an existing identity attribute. In “attributeName” within “identityAttribute” I am using “lastname,” which is also an identity attribute. After provisioning from the source, nothing is generated (it should display “@[corresponding\_lastName]” but it shows the usual value):

 ![imagen](https://global.discourse-cdn.com/sailpoint/original/2X/4/4414da5c6f71f653cad3d6219a995bb49e9098f2.png)

I understand that even if I am not using the correct values, this is just a simulation to see if the information is created correctly and to learn how it works.

Thanks!

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [July 12, 2024, 2:58pm UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/13 "2024-07-12T14:58:52Z")

</div>

```auto
          {
            "name": "sAMAccountName", #source.attribute
            "transform": {
                "type": "rule",
                "attributes": {
                    "name": "Create Unique LDAP Attribute"
                }
            },
            "attributes": {
                "template": "$(samaccountnameCalculate)$(uniqueCounter)",
                "cloudMaxUniqueChecks": "10",
                "cloudMaxSize": "20",
                "cloudRequired": "true"
            },
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },

```

In the above code I am creating an account in AD (doesn’t matter where).  
The value “name” is a field in AD (saMAccountName) that is being populated by the CREATE profile.  
It appears that you are trying to populate an Identity.Attribute (cloudLifecycleState) rather than a Source.attribute. You need to choose an attribute on the source that you are creating to apply that transform to.

Or for a very simple transform where I want the Identity.Attribute “displayName” to be mapped to Source.Attribute that I am creating:

```auto
        {
            "name": "displayName", #source.attribute
            "transform": {
                "type": "identityAttribute",
                "attributes": {
                    "name": "displayName" #identity.attribute
                }
            },
            "attributes": {},
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },

```

---

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 15, 2024, 6:30am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/14 "2024-07-15T06:30:57Z")

</div>

Good morning, it still doesn’t work. We have tried with different attributes and nothing. For example:

![imagen](https://global.discourse-cdn.com/sailpoint/original/2X/1/1212e9b8d1206106ed3dd593ac1dafdc2ecd8382.png)

---

<div class="post-metadata">

**Author:** ![shaileeM](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/shaileem/32/15314_2.png) [@shaileeM](https://developer.sailpoint.com/discuss/u/shaileeM)\
**Post date:** [July 15, 2024, 7:50am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/15 "2024-07-15T07:50:00Z")

</div>

Hi,

“attributeName” should be “name” in the innermost nested transform { }

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [July 15, 2024, 7:59am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/16 "2024-07-15T07:59:32Z")

</div>

as per the above, this is how it should look

```auto
                         
 "type": "identityAttribute",
 "attributes": {
    "name": "lastName"
  }

```

---

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 15, 2024, 8:08am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/17 "2024-07-15T08:08:28Z")

</div>

@PhilRawlings1 hanks @shaileeM and @PhilRawlings1

We have tried several combinations and it still doesn’t work. We also tried with ‘name’ and it doesn’t work. Additionally, we tried with ‘lastname’ and ‘lastName’ to rule out all options:

![imagen](https://global.discourse-cdn.com/sailpoint/original/2X/3/3c8338be73a71b822f2e52be7740c3d98bd87433.png)

![imagen](https://global.discourse-cdn.com/sailpoint/original/2X/d/d10fcba941b72e5ae6fd3806117ba3d1ca7ce30a.png)

 ![imagen](https://global.discourse-cdn.com/sailpoint/original/2X/3/396740e4179f52e6a6f16f9d7e2b9e868823cd89.png)

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [July 15, 2024, 8:42am UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/18 "2024-07-15T08:42:27Z")

</div>

Lets work from the beginning and start with a static value like this:

```auto
          {
            "name": "Account",
            "description": null,
            "usageType": "CREATE",
            "fields": [
              {
                "name": "distinguishedName",
                "transform": {
                  "type": "static",
                  "attributes": {
                    "value": "Test User"
                  }
                },
                "attributes": {
                  "cloudRequired": "true"
                },
                "isRequired": false,
                "type": "string",
                "isMultiValued": false
              }
}
```

---

<div class="post-metadata">

**Author:** ![smenendezp](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@smenendezp](https://developer.sailpoint.com/discuss/u/smenendezp)\
**Post date:** [July 16, 2024, 1:23pm UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/19 "2024-07-16T13:23:23Z")

</div>

it is not working, but we believe it is due to another error we are checking. Thanks for all the help!

Hopefully, the problem that started this thread and has been reported for two weeks will be resolved soon.

Regards.

---

<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:** [September 14, 2024, 1:24pm UTC](https://developer.sailpoint.com/discuss/t/problem-with-username-generator/72402/20 "2024-09-14T13:24:06Z")

</div>

Closed on September 14, 2024, 1:24pm UTC

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