Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Username as SystemUsername

sabthamis
New Contributor
New Contributor

Hi Everyone,

We have a requirement to assign the systemusername as Username. Systemusername is generated by Saviynt based on firstname lastname which is working fine. 

I have added the same logic as in mentioned for systemusername in Registeruser rule(screenshot below). But still when i import a user manually from UI this is not updating with systemusername value.

 

Any idea how to achieve this ?

 

sabthamis_0-1726845582574.png

 

34 REPLIES 34

rushikeshvartak
All-Star
All-Star

rushikeshvartak_0-1726846821227.png

copysystemusernametousername=true

 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Can you say which file is this and where to get this one ? externalconfig.properties ? @rushikeshvartak 

@rushikeshvartak  one more thing when i run the import job without username column the import fails does this change you suggested above ll resolve that issue as well ?

Yes  externalconfig.properties and username is mandatory


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak  I have updated this from configuration files and restarted the application. Then i imported the user from csv file from import user option but still i see the username is updated with some random numeric values.

indra_hema_95
Regular Contributor III
Regular Contributor III

Hi @sabthamis If you are not putting user name in your csv then you have to use some other attribute as reconciliation field, and for that field a value has to be there in your csv and that has to be unique for each user. 

Regards,

Indra

NM
Honored Contributor II
Honored Contributor II

Hi @sabthamis did you populate the generate username option in global config?

If you are using an attribute in register form which isn't present in CSV file it might fail the username generration

sabthamis
New Contributor
New Contributor

@NM  yes i m using a field username in my input file. Also the register user rule (username rule) and systemusername generation  is also configured in global setting . When I added the username field as you told and tried to  import the user in saviynt the user is not importing.

sabthamis_0-1727087209571.png

 

NM
Honored Contributor II
Honored Contributor II

@sabthamis if you keep username field empty as you are trying to create a new account.

Does it automatically created a user ID try once and share logs

sabthamis
New Contributor
New Contributor

the username s created as some numeric values and systemusername generated as per my logic i added.

  • What was reconciliation field selected during import ?
  • Please share logs in .txt file

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak  I have made the changes in configuration file and i imported the user from csv file. Manual user import. I have not configured any job to import the user to test it. While the file import i just kept the reconciliation field as Blank.

  • You can't keep the reconciliation field as blank; there should be some unique field like employee ID.

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak  in the actual user import job i use username as reconciliation field...should i try to import the user from csv with a unique attribute and use it as reconciliation field while import...?

Yes


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak  -  I have tried with below file and used CP7 as recon field while importing. I still don't see the systemusername is copied as username

sabthamis_0-1727190391215.png

 

@rushikeshvartak I am using the below rule in Register user rule. I am using the same in systemusername generation in which it works. but getting below error in log when i use the same code for register user rule.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at

CASE
       WHEN (users.middlename IS NOT NULL)  THEN
                CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,6))
###CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5) , substring('1',1,1)) ###CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5) , substring('2',1,1))
###CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5) , substring('3',1,1))
ELSE
                CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,7))
### CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6) , substring('1',1,1))
### CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6) , substring('2',1,1))
### CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6) , substring('3',1,1))
END

@rushikeshvartak  Can i use inline preprocessor to use the systemusername as username while identity is created ?

  • Did you defined system user name in global configuration

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

yes its defined and its working fine. the only thing is we need to use the same value for username. @rushikeshvartak 

Can you share logs


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak  Now i can generate the username using the same code used for  systemusername. But I see they both are different means its taking username and appending 1 duplicate check is done against username and system username i guess. Attached here is the log and screenshot for the same.

 

sabthamis_0-1727256324924.png

Code used for Username:

CASE
       WHEN (users.middlename IS NOT NULL)  THEN            CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,6))
#CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5) , substring('1',1,1)) #CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5) , substring('2',1,1))
#CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5) , substring('3',1,1))
ELSE
                CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,7))
# CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6) , substring('1',1,1))
#CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6) , substring('2',1,1))
# CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6) , substring('3',1,1)) END.
Code used for systemusername:
CASE
       WHEN (users.middlename IS NOT NULL)  THEN
                CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,6))
#CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5)   , substring('1',1,1)) #CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5)   , substring('2',1,1))
#CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.middlename),1,1),SUBSTRING(lower(users.lastname),1,5)   , substring('3',1,1))
ELSE
                CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,7))
# CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6)   , substring('1',1,1))
# CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6)   , substring('2',1,1))
# CONCAT(SUBSTRING(lower(users.firstname),1,1),SUBSTRING(lower(users.lastname),1,6)   , substring('3',1,1))
END

 

Do you have any other user with same username ?


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

No i checked it from Data analyzer only user i getting in result it the same user.

sabthamis_0-1727357139260.png

 

  • You need to run your logic from data analyzer

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Also you have extra ) in SQL, run query from data analyzer and validate


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Updated query which i using is below i don't see any error when running from data analyzer 

 

CASE
    WHEN (users.middlename IS NOT NULL) THEN
   
                CONCAT(
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.firstname, '[^a-zA-Z]', '')), 1, 1),
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.middlename, '[^a-zA-Z]', '')), 1, 1),
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.lastname, '[^a-zA-Z]', '')), 1, 6))
     
                ###CONCAT(
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.firstname, '[^a-zA-Z]', '')), 1, 1),
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.middlename, '[^a-zA-Z]', '')), 1, 1),
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.lastname, '[^a-zA-Z]', '')), 1, 5) , substring('1',1,1))
 
 
###CONCAT(
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.firstname, '[^a-zA-Z]', '')), 1, 1),
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.middlename, '[^a-zA-Z]', '')), 1, 1),
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.lastname, '[^a-zA-Z]', '')), 1, 5),
                    substring('2',1,1))
 
###CONCAT(
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.firstname, '[^a-zA-Z]', '')), 1, 1),
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.middlename, '[^a-zA-Z]', '')), 1, 1),
                    SUBSTRING(LOWER(REGEXP_REPLACE(users.lastname, '[^a-zA-Z]', '')), 1, 5),
                    substring('3',1,1))
 
            ELSE
                CONCAT(
            SUBSTRING(LOWER(REGEXP_REPLACE(users.firstname, '[^a-zA-Z]', '')), 1, 1),
            SUBSTRING(LOWER(REGEXP_REPLACE(users.lastname, '[^a-zA-Z]', '')), 1, 7))
 
   ###CONCAT(SUBSTRING(LOWER(REGEXP_REPLACE(users.firstname, '[^a-zA-Z]', '')), 1, 1),
            SUBSTRING(LOWER(REGEXP_REPLACE(users.lastname, '[^a-zA-Z]', '')), 1, 6) , substring('1',1,1))
  ###CONCAT(SUBSTRING(LOWER(REGEXP_REPLACE(users.firstname, '[^a-zA-Z]', '')), 1, 1),
            SUBSTRING(LOWER(REGEXP_REPLACE(users.lastname, '[^a-zA-Z]', '')), 1, 6) , substring('2',1,1))
###CONCAT(SUBSTRING(LOWER(REGEXP_REPLACE(users.firstname, '[^a-zA-Z]', '')), 1, 1),
            SUBSTRING(LOWER(REGEXP_REPLACE(users.lastname, '[^a-zA-Z]', '')), 1, 6) , substring('3',1,1))
END
 
sabthamis_0-1727357924266.pngsabthamis_1-1727357987045.png

 

Add all conditions with same user


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

I used the below query..I doubt if it will work since we use ### for multiple condition getting error as 

Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SUBSTRING(LOWER(REGEXP_REPLACE('Sabthami', '[^a-zA-Z]', '')), 1, 1), SUB' at line 9

use case when


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak  I am able to achieve it . Thanks. We can directly map the systemusername to username in global configuration which worked for my requirements.

Can you share configs Screenshot


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

sabthamis_0-1727360615880.png

sabthamis_1-1727360705051.png

@rushikeshvartak  here you go...

 

Can you edit reply and also add username screenshot and logic and accept your answer as solution


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.