We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Need help for system username generation

SIRAJMOLLA
New Contributor III
New Contributor III

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

2 REPLIES 2

rushikeshvartak
All-Star
All-Star

Add if sql condition to check if systemusername is not already in use


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

Hi Rushikesh Vartak,

Can you provide me the sample for that which you mentioned above.I am using the below logic -

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))))

 

With Regards,

Siraj Molla