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 is getting generated in numbers using SQL query

Kaustubh
Regular Contributor
Regular Contributor

Hi,

We are using a query to generate email and username. (attached the file Query_version1.txt).

Later we added a condition to check if customproperty30 is null. Using the query, we are able to generate email successfully, but username is getting generated as numbers. (attached file Query_version2.txt)

Kaustubh_0-1729505290186.png

 


Kaustubh Pawar
Saviynt Certified IGA Professional
7 REPLIES 7

NM
Honored Contributor III
Honored Contributor III

@Kaustubh what result do you get when you run in data analyzer

 


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

Kaustubh
Regular Contributor
Regular Contributor

I get expected output

Kaustubh_0-1729506103282.png

 


Kaustubh Pawar
Saviynt Certified IGA Professional

NM
Honored Contributor III
Honored Contributor III

@Kaustubh but from the username generation rule you are not getting the expected output?


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

Kaustubh
Regular Contributor
Regular Contributor

Hi @NM if I put same code (Query_version2.txt) in both username and email generation logic, email is getting generated correctly but username is generated in numbers as image below

Kaustubh_0-1729507227208.png

 



If the code is same in email generation and add register user rule, then I expect both email and username to be same which is not happening.


Kaustubh Pawar
Saviynt Certified IGA Professional

NM
Honored Contributor III
Honored Contributor III

@Kaustubh can you share logs at the time of new user creation?


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

Kaustubh
Regular Contributor
Regular Contributor

The userkey and username is same

Kaustubh_0-1729514505409.png

 


Kaustubh Pawar
Saviynt Certified IGA Professional

IF(users.customproperty30 IS NOT NULL,users.customproperty30,IF(users.lastname is null,
	LOWER(
        CONCAT(
                    REGEXP_REPLACE(users.firstname, '[()<>^ ]', ''), 
                    '_1@domain.com')), 	
	IF(
        LENGTH(
            LOWER(
                CONCAT(
                    REGEXP_REPLACE(users.firstname, '[()<>^ ]', ''), 
                    '_', 
                    REGEXP_REPLACE(SUBSTRING_INDEX(users.lastname, ' ', -1), '[()<>^ ]', '')
                )
            )
        ) < 21,
        LOWER(
            CONCAT(
                REGEXP_REPLACE(users.firstname, '[()<>^ ]', ''), 
                '_', 
				REGEXP_REPLACE(SUBSTRING_INDEX(users.lastname, ' ', -1), '[()<>^ ]', ''),
                '@domain.com'
            )
        ),
        IF(
            LENGTH(REGEXP_REPLACE(users.firstname, '[()<>^ ]', '')) > LENGTH(REGEXP_REPLACE(SUBSTRING_INDEX(users.lastname, ' ', -1), '[()<>^ ]', '')),
            LOWER(
                CONCAT(
                    SUBSTRING(REGEXP_REPLACE(users.firstname, '[()<>^ ]', ''), 1, 1), 
                    '_', 
                   REGEXP_REPLACE(SUBSTRING_INDEX(users.lastname, ' ', -1), '[()<>^ ]', ''),
                    '@domain.com'
                )
            ),
            LOWER(
                CONCAT(
                      REGEXP_REPLACE(users.firstname, '[()<>^ ]', ''),
                    '_', 
					SUBSTRING(REGEXP_REPLACE(users.lastname, '[()<>^ ]', ''), 1, 1), 					
                    '@domain.com'
                )
            )
        )
    )) )

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