Leveraging Intelligent Recommendations for Operational Transformation. AMS Partners Click HERE | EMEA/APJ Click HERE |
05/17/2024 02:45 PM
Hi,
We have a requirement to generate a code with prefix data like 'S81' + random numbers and use that as the account name for AD during account creation. What is the best way to achieve this?
We were thinking of having a Dataset with the defined prefix data but not sure how to get 'S81' + random numbers during account creation. We also need to make sure it is a unique identifier and the account name that is generated is not an existing account name. We will not be able to reference the accounts data in pre-processor too. Any recommendations on how to approach it?
Thanks,
Deepa.S
05/17/2024 03:27 PM - edited 05/17/2024 03:28 PM
Hi @deepa,
Can you try below:
Account Name Rule: select concat('S81',FLOOR(RAND()*10000)) # select concat('S81',FLOOR(RAND()*10000)) # select concat('S81',FLOOR(RAND()*10000))
Ex: S812461, S817007, S813807
Note:
If this helps your question, please consider selecting Accept As Solution and hit Kudos
05/18/2024 05:59 AM
@deepa We have account name rule every endpoint level , need configure based on your respected endpoint level.
Navigation Endpoint->Endpoint details->Account Name Rule -> Advance Config -> SQL
AccountName Rule : concat('S81',(FLOOR(RAND()*10000)) # concat('S81',(FLOOR(RAND()*10000)) # concat('S81',(FLOOR(RAND()*10000))
Here we passing 10000 5 digit number , based on digit it will apply value 'S81'+ 5digit number , based on you requirement you pass it digit value and click on okay and update endpoint.
Sample Query for checking in Data analyzer:
SELECT CONCAT('S81', FLOOR(RAND() * 10000)) AS RandomString1,CONCAT('S81', FLOOR(RAND() * 10000)) AS RandomString2,CONCAT('S81', FLOOR(RAND() * 10000)) AS RandomString3
05/20/2024 07:02 AM
Hi Prem/Raghu,
The prefix code "S81" is not same always. It will change depending on the user's costcenter hence we were thinking to store all the the prefix in dataset.
Any recommendations on how to handle it when it is the above case for prefix?
Thanks,
Deepa.S
05/20/2024 08:18 AM
@deepa can give sample please ?with "S81" and users.costcenter case :
05/20/2024 08:36 AM
Below is the sample mapping
Costcenter | Prefix |
Sales | S01 |
Marketing | S02 |
Supplies | S81 |
When we create the account for the user we want a customeproperty in user profile for each user based on the costcenter mapping to be updated with this generated code and map it to sAMAccountName during creation of the account.
Costcenter | Prefix | User | Generated code (Prefix + Random number) |
Sales | S01 | User1 | S014567 |
Marketing | S02 | User2 | S027685 |
Supplies | S81 | User3 | S816745 |
Please let me know if you have any further question
05/20/2024 08:41 AM - edited 05/20/2024 08:46 AM
@deepa : You may have to use CASE condition and include all scenarios that are possible and use the same logic others mentioned to generate prefix + random number. Having that in dataset will not help because it is not resolvable in accountname rule.
For details refer Account Name Rule explanation in Viewing-or-Updating-Endpoints
05/20/2024 09:04 AM - edited 05/20/2024 09:05 AM
@deepa try below
conact(case
when user.costcenter = 'sales' then concat('s01', user.costcenter, floor(rand() * 10000))
when user.costcenter = 'marketing' then concat('s02', user.costcenter, floor(rand() * 10000))
when user.costcenter = 'supplies' then concat('s81', user.costcenter, floor(rand() * 10000))
else concat('s81', user.costcenter, floor(rand() * 10000))
end )# conact(case
when user.costcenter = 'sales' then concat('s01', user.costcenter, floor(rand() * 10000))
when user.costcenter = 'marketing' then concat('s02', user.costcenter, floor(rand() * 10000))
when user.costcenter = 'supplies' then concat('s81', user.costcenter, floor(rand() * 10000))
else concat('s81', user.costcenter, floor(rand() * 10000))
end )#conact(
case
when user.costcenter = 'sales' then concat('s01', user.costcenter, floor(rand() * 10000))
when user.costcenter = 'marketing' then concat('s02', user.costcenter, floor(rand() * 10000))
when user.costcenter = 'supplies' then concat('s81', user.costcenter, floor(rand() * 10000))
else concat('s81', user.costcenter, floor(rand() * 10000))
end )
05/20/2024 09:06 AM
case when users.costcenter ='Sales' then concat('S01',(FLOOR(RAND()*10000)) # concat('S81',(FLOOR(RAND()*10000)) when users.costcenter ='Marketing' then concat('S02',(FLOOR(RAND()*10000)) # concat('S81',(FLOOR(RAND()*10000)) when users.costcenter ='Supplies' then concat('S81',(FLOOR(RAND()*10000)) # concat('S81',(FLOOR(RAND()*10000)) END
05/20/2024 09:36 AM
@rushikeshvartak / @Raghu / @Saathvik ,
I have around 400 costcenter/prefix combination. It might grow too. Case condition for this large set is going to unmanagable. Do you think i can do a preprocessor query to manipulate the customproperty using the dataset and use that customproperty for the accountname?
Thanks,
Deepa.S
05/20/2024 09:38 AM
You can use preprocessor and store value on users custom property
05/20/2024 09:48 AM
@deepa : Yes that is possible, Build a dataset with combination of cost center, prefix and populate one of CP's of user to that prefix it should have as part of inline preprocessor and then use that CP in accountname rule
05/20/2024 02:35 PM
@deepa ,
As Rushi and Saathvik mentioned above, use inline preprocessor!
My suggestion here would be
If this helps your question, hit Kudos and please click the 'Accept As Solution' button on the reply (or replies) that best answered your original question.