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

SUBSTRING in colsToPropsMap in ImportAccountEnt JSON

Saviynt_Savvy
Regular Contributor II
Regular Contributor II

Hi All, 

In an application, I have the employeeName attribute value as "abcd/johnpatrick" and I need to bring it to the Account customproperty 9 as "johnpatrick" and need to remove the string before the "/" character.
What is the syntax I should use in the colsToPropsMap to get the substring  after the character "/".

ImportAccountEntJSON (colsToPropsMap):
"colsToPropsMap":{
"accountID":"employeeId~#~char",
"name":"employeeName",
"status":"status~#~char",
"customproperty1":"userName~#~char",
"customproperty2":"emplClassCode~#~char",
"customproperty3":"tellerClassCode~#~char",
"customproperty4":"ptid~#~char",
"customproperty5":"status~#~char",
"customproperty6":"networkAcct~#~char",
"customproperty8":"employeeId~#~char",
"customproperty9":"#CONST#${LEFT(employeeName, CHARINDEX('/',employeeName) -1)}~#~char",
"customproperty31":"STORE#ACC#ENT#MAPPINGINFO~#~char"
},

I am getting  the above syntax as same in the Account CustomProperty 9 as shown below:

Saviynt_Savvy_0-1715667425134.png
What is the correct syntax to use?

Thanks & Regards,
SaviyntSavvy

10 REPLIES 10

Raghu
All-Star
All-Star

@Saviynt_Savvy  you can try below's

"customproperty9": "#CONST#${valueEmp = employeeName.indexOf('/'); valueEmp = employeeName.substring(valueEmp + 1); return valueEmp}"

or

"customproperty9": "#CONST#${valueEmp = employeeName.indexOf('/').substring(valueEmp + 1); return valueEmp}"

 


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

itinjic
Regular Contributor
Regular Contributor

The syntax you are using in the colsToPropsMap for getting the substring after the "/" character is correct. However, it seems like the syntax is not working as expected in your case. One possible solution could be to use the SUBSTRING function along with the CHARINDEX function to get the desired substring.

You can try the following syntax for the customproperty9 mapping:

"customproperty9": "#CONST#${SUBSTRING(employeeName, CHARINDEX('/', employeeName) + 1, LEN(employeeName))}~#~char"

This syntax uses the SUBSTRING function to extract the substring after the "/" character by adding 1 to the index returned by the CHARINDEX function. The LEN function is also used to determine the length of the original string.

Please give this syntax a try and see if it gives you the desired result.

Sapere aude

rushikeshvartak
All-Star
All-Star

Its java functions not myql

"customproperty9":"#CONST#${response.employeeName?.substring(0, response.employeeName.indexOf('/') != -1 ? response.employeeName.indexOf('/') :response.employeeName.length())}


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

Hi @rushikeshvartak ,
Is the syntax going to be the same even in the case of backslash (\).
What if the name is "abcd\john" and need to import only the string "john".

Thanks & Regards,
SaviyntSavvy

Yes i have 

"#CONST#${employeeName.split('\\\\')[0]}~#~char"


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

Hi @rushikeshvartak ,
It's reflecting as same in the customproperty as shown below.

Saviynt_Savvy_0-1715930002438.png
Thanks & Regards,
SaviyntSavyy

 

@Saviynt_Savvy  try below

"customproperty9": "${employeeName?.split('/')[1]}"


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

Typo mistake try below

"customproperty9": ""#CONST#${employeeName?.split('/')[1]}~#~char"


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

"#CONST#${response.employeeName.split('\\\\')[0]}~#~char"


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

Hi @rushikeshvartak ,
Still is just bringing the syntax into the Field, but not able bring the substring text.

Thanks & Regards,
SaviyntSavvy