Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Need help for SamAccount Generation from Saviynt

mollasiraj
Regular Contributor
Regular Contributor

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

5 REPLIES 5

DixshantValecha
Saviynt Employee
Saviynt Employee

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.

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

When you run query from data analyzer are you still getting duplicates ?


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

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-

 
IF((LENGTH(replace(users.lastname,"'","")) >= 4), replace(UPPER(CONCAT(SUBSTRING(replace(users.lastname,"'",""), 1, 4), 1,users.username)),"-",""), replace(UPPER(CONCAT(SUBSTRING(replace(users.lastname,"'",""), 1, length(users.lastname)), 0,1,users.username)),"-",""))
 
But it is working fine for Employee and it is not working for Non-Employee.For Non-Employee it is generating the system username like below-
mollasiraj_1-1686210417435.png

 

and another thing we are generating the username through saviynt for non-employee and for Employee username is coming through another system not generated from saviynt side.As per the rule Employee System username generating correctly. As we are generating the system username and Username both from saviynt side for non-employee that time we are not getting proper System Username as per the rule. Instead of concatenating username with lastname it's adding some reference number(TEST1SAVGEN9050227555023256040).Can you guys suggest for non-employee as we are generating the username and system username through saviynt side how we can get the concatenation of username instead of getting the reference number concatenation.
 
Please let us know how we can resolve this.
 
With Regards,
Siraj Molla

 

DixshantValecha
Saviynt Employee
Saviynt Employee

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.