PARTNERS - Please join us for our upcoming webinar:
Leveraging Intelligent Recommendations for Operational Transformation.
AMS Partners click HERE | EMEA/APJ Partners click HERE

User form for create User is not taking usernames according to username generation logic.

RevatiTarale
New Contributor II
New Contributor II

Hello team,

I created a user form from Admin->identity repository->create a user. My all attributes created are working as expected, but when I create a user, it doesn't take the username according to username generation logic. Below is the query we are using for username and email generation through the create user form and for any user who will be imported. This logic is working for users imported from CSV and Trusted sources, but it doesn't work if I create a user from the user form.

CONCAT LOWER(REPLACE(
IF(LOCATE(' ', users.firstname) > 0,
REPLACE(users.firstname, ' ', ''),
IF(LENGTH(users.firstname) >= 10 AND LENGTH(users.firstname) > LENGTH(users.lastname),
LEFT(users.firstname, 1),
users.firstname)),
' ', ''
)),
'_',
LOWER(REPLACE(
IF(
users.lastname IS NULL OR users.lastname = '',
'1',
IF(LENGTH(users.lastname) >= 10 AND LENGTH(users.firstname) < LENGTH(users.lastname),
LEFT(SUBSTRING_INDEX(users.lastname, ' ', -1), 1),
IF(LOCATE(' ', users.lastname) > 0,
SUBSTRING_INDEX(users.lastname, ' ', -1),
users.lastname
)
)
),
' ', ''
)),
'@gmail.com'
) #
CONCAT(
LOWER(REPLACE(
IF(
LOCATE(' ', users.firstname) > 0,
REPLACE(users.firstname, ' ', ''),
IF(LENGTH(users.firstname) > 10 AND LENGTH(users.firstname) > LENGTH(users.lastname),
LEFT(users.firstname, 1),
users.firstname
)
),
' ', ''
)),
'_',
LOWER(REPLACE(
IF(
users.lastname IS NULL OR users.lastname = '',
'',
IF(LENGTH(users.lastname) > 10 AND LENGTH(users.firstname) < LENGTH(users.lastname),
CONCAT(LEFT(SUBSTRING_INDEX(users.lastname, ' ', -1), 1),'_'),
IF(LOCATE(' ', users.lastname) > 0,
CONCAT(SUBSTRING_INDEX(users.lastname, ' ', -1),'_'),
CONCAT(users.lastname,'_')
)
)
),
' ', ''
)),
'2@gmail.com'
) #
CONCAT(
LOWER(REPLACE(
IF(
LOCATE(' ', users.firstname) > 0,
REPLACE(users.firstname, ' ', ''),
IF(LENGTH(users.firstname) > 10 AND LENGTH(users.firstname) > LENGTH(users.lastname),
LEFT(users.firstname, 1),
users.firstname
)
),
' ', ''
)),
'_',
LOWER(REPLACE(
IF(
users.lastname IS NULL OR users.lastname = '',
'',
IF(LENGTH(users.lastname) > 10 AND LENGTH(users.firstname) < LENGTH(users.lastname),
CONCAT(LEFT(SUBSTRING_INDEX(users.lastname, ' ', -1), 1),'_'),
IF(LOCATE(' ', users.lastname) > 0,
CONCAT(SUBSTRING_INDEX(users.lastname, ' ', -1),'_'),
CONCAT(users.lastname,'_')
)
)
),
' ', ''
)),
'3@gmail.com'
) #
CONCAT(
LOWER(REPLACE(
IF(
LOCATE(' ', users.firstname) > 0,
REPLACE(users.firstname, ' ', ''),
IF(LENGTH(users.firstname) > 10 AND LENGTH(users.firstname) > LENGTH(users.lastname),
LEFT(users.firstname, 1),
users.firstname
)
),
' ', ''
)),
'_',
LOWER(REPLACE(
IF(
users.lastname IS NULL OR users.lastname = '',
'',
IF(LENGTH(users.lastname) > 10 AND LENGTH(users.firstname) < LENGTH(users.lastname),
CONCAT(LEFT(SUBSTRING_INDEX(users.lastname, ' ', -1), 1),'_'),
IF(LOCATE(' ', users.lastname) > 0,
CONCAT(SUBSTRING_INDEX(users.lastname, ' ', -1),'_'),
CONCAT(users.lastname,'_')
)
)
),
' ', ''
)),
'4@gamil.com'
)

Please check the snap of username I am getting this username when I create it using form.

8 REPLIES 8

rushikeshvartak
All-Star
All-Star

You need to use dynamic attributes for username


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

@rushikeshvartak Please can you provide a sample for the dynamic attribute code, also I want to know whether this dynamic value code I need to pass in global configuration > Register User Form (taking username as an attribute). Or where I added username generation logic in (identity repository>Add Register User Rule)?

 

Thanks

Revati

Refer https://forums.saviynt.com/t5/identity-governance/username-generation-rule/m-p/11630#M3315


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

NM
Honored Contributor
Honored Contributor

Hi @RevatiTarale , when you submit the request it should automatically pick username as per the rule configured.

RevatiTarale
New Contributor II
New Contributor II

@NM Username is working fine through CSV upload but when I try with the user form it doesn't take username. Is there any specific configuration required to create through the user Form? Or is there any function restriction in my query that is causing the issue?

@rushikeshvartak We don't have any specific condition in my query to take dynamic attribute as in your mentioned reference doc they have employee Type, so they used dynamic attribute. In my case, we have global logic for all users. 

Any suggestions or ideas regarding issue please help.

 

Thanks

Revati Tarale

 

 

Hi @RevatiTarale 

As mentioned by @rushikeshvartak  and @NM the usernames on the form is not automatically picked up during the user creation. 

Do you have any field on the user creation form for the username? Can you please share the user creation form and the dynamic attributes configured?

 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

Hello @naveenss 

Before I didn't create any username attribute in the user form, I also tried creating one attribute for testing with the same logic as the username generation rule. Both didn't work.

Please check the attached snap of the user creation form attribute configuration.

Thanks

Revati Tarale

  • You need to use dynamic attribute for user creation form and set user column as username

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