Click HERE to see how Saviynt Intelligence is transforming the industry. |
09/26/2024 04:41 AM - edited 09/26/2024 04:48 AM
Hi team,
We have a requirement where we need to use Saviynt as an HR source and for that we are making use of the create/register user form. While we have most of the functionality working, we are facing a problem with users' first and last names in case they have special characters in them (like spaces or apostrophes).
Normally, we copy and store the firstname and lastname values in separate customproperties and the special characters are removed beforehand through a preprocessor rule. These customproperties are then used in our username and email generation rules.
We are looking to replicate the same functionality through the register user form, and we have created dynamic attributes that store the values received in firstname and lastname in the customproperties. But our problem is that we are unable to use replace functions to replace the special characters before storing the values. This, in turn, is messing up our username and email addresses.
I would appreciate any help or guidance on how we can achieve this through the register user form.
Here is what we have done so far -
Taking an example of lastname, here is how the dynamic attributes look like. The first one is 'lastname' which captures the last name value from the user input and stores on the lastname user column -
Then we have 'lname' which is supposed to transform the value in 'lastname' by removing special chars and store the final value in cp59.
But the cp59 stays unpopulated
The values we have tried using -
1. select LOWER(REGEXP_REPLACE(${lastname}, '[., \\-]', '')) as ID
2. select ${LOWER(REGEXP_REPLACE(lastname, '[., \\-]', ''))} as ID
3. select REPLACE(REPLACE(REPLACE(REPLACE(${lastname}, ',', ''),' ', ''),'-', ''),'.', '') as ID
Without any replace function, the functionality is working as expected.
Thanks in advance!
Solved! Go to Solution.
09/26/2024 04:59 AM
@Pushkar keep it visible in form the lname attribute and see the result once.
09/26/2024 05:05 AM
@Pushkar what I will suggest apply regex condition so user will input only characters like below.
^[a-zA-Z]*$
09/26/2024 06:44 AM
@NM Thank you for the suggestion. However, the thing is, if I do not have a replace function there, it works without problem (e.g., if I simply set 'select ${lastname} as ID', the value of lastname will be stored in cp59 successfully. It does not seem to work with the replace function.
09/26/2024 06:48 AM
SELECT LOWER(REPLACE(REPLACE(REPLACE(REPLACE(${lastname}, ',', ''), ' ', ''), '-', ''), '.', '')) as ID
09/26/2024 07:33 AM
@rushikeshvartak wrote:SELECT LOWER(REPLACE(REPLACE(REPLACE(REPLACE(${lastname}, ',', ''), ' ', ''), '-', ''), '.', '')) as ID
Thank you for the suggestion but that did not work either. My user's last name was "us-er 12" and the value stored in cp59 was empty.
@NM wrote:@Pushkar what I will suggest apply regex condition so user will input only characters like below.
^[a-zA-Z]*$
I believe this will be our last resort, but yes, this can be done too.
09/26/2024 08:34 AM
Can you share logs
09/26/2024 11:47 PM
Thank you @NM and @rushikeshvartak for your valuable suggestions. I've figured out what I was doing wrong - putting the replace function in 'Values' field instead of the 'Default Values' field. As soon as I put the function in the 'Default Values', it started working as expected.
I hope this piece of learning helps anyone in the same boat as I was.
For reference, the replace function I am finally using is -
select FN_EIC_REPLACE(LOWER(REGEXP_REPLACE(${lastname}, '[., \\-]', '')) , null) as ID
Thank you!