Click HERE to see how Saviynt Intelligence is transforming the industry. |
07/04/2024 10:02 PM - edited 07/04/2024 11:22 PM
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.
07/04/2024 11:04 PM
You need to use dynamic attributes for username
07/05/2024 03:16 AM
@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
07/05/2024 06:53 AM
Refer https://forums.saviynt.com/t5/identity-governance/username-generation-rule/m-p/11630#M3315
07/05/2024 06:54 AM
Hi @RevatiTarale , when you submit the request it should automatically pick username as per the rule configured.
07/09/2024 03:53 AM
@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
07/09/2024 04:30 AM
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?
07/09/2024 10:02 PM
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
07/09/2024 10:37 PM