Generating Unique name using uniqueCounter

Hello,
I am trying to use the below code for generating Unique user name using uniqueCounter.
But its reflecting error.
{

“name”: “UsernameGenerator Transform”,

“type”: “static”,

“attributes”: {

"FirstName": {

  "type": "lower",

  "attributes": {

    "input": {

      "type": "substring",

      "attributes": {

        "input": {

          "type": "accountAttribute",

          "attributes": {

            "attributeName": "FirstName",

            "sourceName": "TestSF"

          }

        },

        "begin": 0,

        "end": 1

      }

    }

  }

},

"LastName": {

  "type": "upper",

  "attributes": {

    "input": {

      "type": "substring",

      "attributes": {

        "input": {

          "type": "accountAttribute",

          "attributes": {

            "attributeName": "LastName",

            "sourceName": "TestSF"

          }

        },

        "begin": 0,

        "end": 1

      }

    }

  }

},

"value": 

{

"patterns": [

                  "$FirstName$LastName$(uniqueCounter)"

                      ]

}

}

}

error-{patterns=[[email protected]]}

Hi @kumarikrity,

The “usernameGenerator” transform can only be applied to an attribute that is marked as an Account ID in the Account Schema. For e.g., in case of the Active Directory source, we can use this transform only to generate the unique distinguishedName by defining different patterns. But, if you want to generate the unique value for other attributes then you will need to leverage the “Attribute Generator Rule”.

I hope this helps.

Thanks,
Sushant

Thank You @Sushantmrj .
As i have marked attribute as an Account ID in the Account Schema. I have to use this unique counter for generate PersonID.

Hi @kumarikrity,

I believe you will need to apply the “usernameGenerator” in the “Create Profile” for an Account ID attribute.
Could you please apply the below version of the transform in the “Create Profile” and see if it works (I haven’t tested it)

{
   "attributes":{
      "cloudMaxSize":"20",
      "cloudMaxUniqueChecks":"50",
      "cloudRequired":"true"
   },
   "isRequired":false,
   "multi":false,
   "name":"PersonID",
   "transform":{
      "type":"usernameGenerator",
      "attributes":{
         "sourceCheck":true,
         "patterns":[
            "$FirstName$LastName$(uniqueCounter)"
         ],
         "FirstName":{
            "type":"lower",
            "attributes":{
               "input":{
                  "type":"substring",
                  "attributes":{
                     "input":{
                        "type":"accountAttribute",
                        "attributes":{
                           "attributeName":"FirstName",
                           "sourceName":"TestSF"
                        }
                     },
                     "begin":0,
                     "end":1
                  }
               }
            }
         },
         "LastName":{
            "type":"upper",
            "attributes":{
               "input":{
                  "type":"substring",
                  "attributes":{
                     "input":{
                        "type":"accountAttribute",
                        "attributes":{
                           "attributeName":"LastName",
                           "sourceName":"TestSF"
                        }
                     },
                     "begin":0,
                     "end":1
                  }
               }
            }
         }
      }
   },
   "type":"static"
}

According to your screenshot, it looks like you want to generate the value for “PersonID”. If that’s not the case, change the attribute’s name in the above transform.

Note: Make sure that the FirstName and LastName attributes from the source “TestSF” are not null.

Thanks,
Sushant

Hi @Sushantmrj Thank You for your reply.
In my lower environment, we have not setup VA , so we don’t have AD connection now.
I want to check above logic ( generate Person ID) with Dummy Authoritative Source.
Is it possible to implement with unique Counter?