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

Replace special characters in first name and last name on User Create/Register Form

Pushkar
New Contributor II
New Contributor II

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 - 

DA - lastname 1.png

DA - lastname 2.png

Then we have 'lname' which is supposed to transform the value in 'lastname' by removing special chars and store the final value in cp59.

DA - lname 1.png

DA - lname 2.png

DA - lname 3.png

But the cp59 stays unpopulated

Pushkar_0-1727350804606.png

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!

7 REPLIES 7

NM
Honored Contributor II
Honored Contributor II

@Pushkar keep it visible in form the lname attribute and see the result once.

NM
Honored Contributor II
Honored Contributor II

@Pushkar what I will suggest apply regex condition so user will input only characters like below.

^[a-zA-Z]*$

Pushkar
New Contributor II
New Contributor II

@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.

SELECT LOWER(REPLACE(REPLACE(REPLACE(REPLACE(${lastname}, ',', ''), ' ', ''), '-', ''), '.', '')) as ID


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


@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.

Can you share logs


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

Pushkar
New Contributor II
New Contributor II

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!