and more in a single search tool across platforms. Read the announcement here. |
05/24/2023 11:58 PM
Hi All,
We have usecase to generate the samaccount from saviynt below is the logic for samaccount-
If user lastname containing more than four character or equal to four character then it will take first four character from lastname and then add one and then add three random digit if it is not containing four character in lastname then it will take the lastname and add zero one then it will add three random digit.
Suppose lastname is GUPTA then SamAccount will be GUPT1223
and if lastname is ROY then SamAccount will be ROY01345 like that.
Below is the logic that I am using in Global configuration System Username generation option for achieve that usecase
IF((LENGTH(replace(users.lastname,"'","")) >= 4), UPPER(CONCAT(SUBSTRING(replace(users.lastname,"'",""), 1, 4), 1,FLOOR(RAND()*(999-100+1)+100))), UPPER(CONCAT(SUBSTRING(replace(users.lastname,"'",""), 1, 3), 0,1,FLOOR(RAND()*(999-100+1)+100))))
we created so many user earlier and we see it's generating unique system username that we are using for our SamAccount Name but currently we see that some time it is generating duplicate.Can anyone suggest me how this issue can be fixed.
With Regards,
Siraj Molla
05/28/2023 11:56 PM
Hi @mollasiraj,
To address the issue of duplicate system usernames being generated using the provided logic, you can modify the approach slightly to ensure uniqueness. One way to achieve this is by appending a unique identifier, such as a timestamp or a counter, to the generated username. Here's an updated example of logic that incorporates this modification:
IF ((LENGTH(REPLACE(users.lastname,"'","")) >= 4),
UPPER(CONCAT(SUBSTRING(REPLACE(users.lastname,"'",""), 1, 4), 1, FLOOR(RAND()*(999-100+1)+100))),
UPPER(CONCAT(SUBSTRING(REPLACE(users.lastname,"'",""), 1, 3), 0, 1, FLOOR(RAND()*(999-100+1)+100)))
) + CONVERT(VARCHAR(20), GETDATE(), 112) -- Appending a unique identifier (timestamp) to ensure uniqueness
Please validate and let us know if further details are needed.
05/29/2023 04:13 AM
Hi DixshantValecha ,
I use the above logic and using the unique lastname that's not present in our system but still it is not generating System Username.
Please let me know how this issue can be fixed.
With Regards,
Siraj Molla
05/29/2023 03:38 PM
When you run query from data analyzer are you still getting duplicates ?
06/08/2023 12:47 AM
Hi Rushikesh,
I am getting duplicate as I am using random function into logic that's why I am using the below logic for generating unique system username-
10/30/2023 01:39 AM
Hi @mollasiraj,
To generate unique system usernames for non-employees in Saviynt, you can try the following approach:
Map the unique attribute (such as EmployeeID) to the userName field in Saviynt.
Use the mapped attribute as the Recon Field.
Generate the system username in Saviynt using a rule that concatenates the mapped attribute with the last name and first name of the user. For example, you can use the following rule:
IF((LENGTH(replace(users.lastname,"'","")) >= 4), replace(UPPER(CONCAT(SUBSTRING(replace(users.lastname,"'",""), 1, 4), 1,users.mappedAttribute)),"-",""), replace(UPPER(CONCAT(SUBSTRING(replace(users.lastname,"'",""), 1, length(users.lastname)), 0,1,users.mappedAttribute)),"-",""))
Please validate and let us know.