Click HERE to see how Saviynt Intelligence is transforming the industry. |
05/13/2024 02:38 AM
Hi,
We have a requirement to generate a username:
Check if the user has preferedFirstName -> if yes it should be preferedFirstname.lastname
else -> firstname.lastname
Autoincrement should also apply to these rules. What would be the right way to do this?
Thank you.
Solved! Go to Solution.
05/13/2024 04:32 AM
Hi @TheSaviyntBoy ,
CASE WHEN (preferedfirstname!='' OR preferedfirstname is not null) THEN replace(concat(preferedfirstname,lastname),' ','') else replace(concat(firstname,lastname),' ','') END
#
CASE WHEN (preferedfirstname!='' OR preferedfirstname is not null) THEN replace(concat(preferedfirstname,lastname,1),' ','') else replace(concat(firstname,lastname,1),' ','') END
#
CASE WHEN (preferedfirstname!='' OR preferedfirstname is not null) THEN replace(concat(preferedfirstname,lastname,2),' ','') else replace(concat(firstname,lastname,2),' ','') END
Note: Please use it as reference. The code only has 2 iterations. Please add more while testing and knowing the duplicates in the system.
If this helps your question, please consider selecting Accept As Solution and hit Kudos
05/13/2024 07:55 AM
Hi,
I tried the above rule, and it gave me the following error:
Hi tried different combinations like adding 'users.' before the column names, instead of 'is not' I used != and vice versa.
05/13/2024 08:11 AM
Hi @TheSaviyntBoy , are you trying to create users via saviynt API/UI for via HR import?
05/13/2024 08:13 AM
Hi @NM , eventually we will be using HR import, for now, I am testing with CSV feed.
05/13/2024 08:20 AM
Understood, use the same which @PremMahadikar added .. don't add users. before any property and try
05/13/2024 08:24 AM
@NM yes I tried that, its not working.
05/13/2024 08:26 AM
@TheSaviyntBoy what are doing you see after making the change?? If you can share that as well..
05/13/2024 08:31 AM
05/13/2024 09:03 AM
@TheSaviyntBoy , I want to check with you regarding systemusername. Is username being same as systemusername here?
05/13/2024 09:28 AM
Hi @PremMahadikar,
The use of systemUsername isn't decided yet, but yes it can be the same as the username.
05/13/2024 09:44 AM
If systemusername is same here:
Use the same logic in systemusername generation (Admin -> Global Configurations -> Identity Lifecycle -> Admin System Username Generation Rule)
CASE WHEN (users.preferedfirstname!='' OR users.preferedfirstname is not null) THEN replace(concat(users.preferedfirstname,users.lastname),' ','') else replace(concat(users.firstname,users.lastname),' ','') END ### case WHEN (users.preferedfirstname!='' OR users.preferedfirstname is not null) THEN replace(concat(users.preferedfirstname,users.lastname,1),' ','') else replace(concat(users.firstname,users.lastname,1),' ','') end ### case WHEN (users.preferedfirstname!='' OR users.preferedfirstname is not null) THEN replace(concat(users.preferedfirstname,users.lastname,2),' ','') else replace(concat(users.firstname,users.lastname,2),' ','') end
In username generation logic, call systemusername.
I tested this; it's working. please try!
For username generation logic, without any iteration - It's working. With # or ###, it's not generating. If only username should be generated, I would suggest you to use inline preprocessor.
If this helps your question, please Accept As Solution and hit Kudos
05/13/2024 10:10 AM
Hi @PremMahadikar , as per my knowledge systemusername rule will only come into picture when we perform operation via import and not at the time of import am I right?
05/13/2024 10:31 AM
@NM , I didn't get you. What you mean by 'perform operation via import and not at the time of import'?
05/13/2024 10:33 AM
Hey @PremMahadikar , sorry mixed up the words .. rewriting below
systemusername rule under global config will only come into picture when we create user from UI and not at the time of import from HR system right?
05/13/2024 10:51 AM
@NM ,
Thats okay. This query is clear!
No, it can be also used during job import. In the user import job trigger, you have an option to select 'yes' or 'No'
If this helps your question, please Accept As Solution and hit Kudos
05/13/2024 11:14 PM
@PremMahadikar , i meant username.
05/14/2024 12:02 AM
@TheSaviyntBoy , Good to hear it worked!
@NM ,
If you like my solution, please hit Kudos!
05/13/2024 09:14 PM
Hi @PremMahadikar ,
Tried the query given above, and it did create the users this time but with some random numbers and no systemusername is generated.
05/13/2024 09:40 PM
Did you selected required options during import ? Share logs
05/13/2024 10:34 PM
Yes, I missed that option, the query is working fine now.
Thank you.