Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/04/2024 11:03 PM
There is scenario where we need to escape special characters like [',-,(,),_,], while creating account in SQL Server application. During account creation we encounter values for First name/Last name/email/Display name are with the special characters as [',-,(,),_,].
Example:
First Name/Last Name: "Ha'reg, Ha-reg, Ha_reg ",
Email: "ha'reg.abadi@companyname.com, ha'reg-abadi@companyname.com" ha_reg.abadi@companyname.com etc.
Can anyone help on this query to escape special characters in create account JSON for Database Connector?
08/04/2024 11:10 PM
Hi @SKulkarni , use SQL replace function
REPLACE(user.firstname,''','\'')
08/05/2024 12:40 AM - edited 08/05/2024 12:45 AM
08/05/2024 01:07 AM
Hi @SKulkarni , if you try it for a user without any special characters does that work? As in does provision work?
08/05/2024 04:10 AM
Hi @NM
Yes. it works fine without special character.
08/05/2024 02:06 AM
${user.firstname.replaceAll("-", "").replaceAll("\\(", "").replaceAll("\\)", "").replaceAll("_", "").replaceAll("'", "")}
08/04/2024 11:43 PM
@SKulkarni share account json please
08/05/2024 06:17 AM
08/05/2024 06:44 PM
{
"UpdateAccountQry": [
"EXEC MVS.proven.view_updateuser '${user.customproperty5}', '${user.customproperty2}', '${user.customproperty1 == null ? user.lastname : user.customproperty1}', '${user.preferedFirstName == null ? user.firstname : user.preferedFirstName}', '${user.middlename == null ? '' : user.middlename}', '${user.email == null || user.customproperty7 == 'N' ? '' : user.email.replaceAll(\"-\", \"\").replaceAll(\"\\\\(\", \"\").replaceAll(\"\\\\)\", \"\").replaceAll(\"_\", \"\").replaceAll(\"'\", \"\")}', '${user.customproperty20 == 'Leave of Absence' ? -9 : (user.customproperty20 == 'Returned From LOA' ? 1 : 1)}', NULL, '${user.employeeid == null ? '' : user.employeeid}', '${user.username}', NULL, '${user.customproperty8 == null ? '' : user.customproperty8}', '${user.employeeType == '8888' && user?.customproperty27 != null ? user?.customproperty27 : ''}', 'ENGINE', NULL, '${task?.id}', NULL, NULL"
]
}
08/05/2024 10:19 PM
Thank you for reply.
The suggested JSON is not working and we got the following error message, "Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported)"
08/06/2024 10:31 AM
Is it working without replaceAll logic ?