Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

How to concat data in create account json for username using rest connector

Bhargavi3
New Contributor
New Contributor

Hi Team,

We have a requirement where Saviynt should generate account name in createAccountJson based on some user attributes like location, department number. I am using the below code to generate username. but it is not working. Please help me to resolve this. Please find the below code for the reference which I am using.

"httpParams":"{\"username\":\"CONCAT(SUBSTRING(${user.COUNTRY},1,1), ${user.LOCATIONNUMBER}, SUBSTRING(${user.firstname},1,1), SUBSTRING(${user.lastname},1,2), RIGHT(${user.customproperty40},1))
\"     

and tried the below also

"httpParams":"\${user.country.substring(0,1) user.location.substring(0,1) user.firstname.substring(0,1) user.lastname.substring(0,2) user.cp.substring(5,6)}\"

Thanks,

Bhargavi Padaraju.

6 REPLIES 6

rushikeshvartak
All-Star
All-Star

"httpParams": "${user.country.substring(0,1).concat(user.location.substring(0,1)).concat(user.firstname.substring(0,1)).concat(user.lastname.substring(0,2)).concat(user.cp.substring(5,6))}"


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Thanks @rushikeshvartak , task got completed by using the query which you have provided, but we cannot cross verify as we are doing reconcilation through CSV file import. 

"httpParams":"{\"username\":\"${user.country.substring(0,1).concat(user.locationnumber.substring(0,1)).concat(user.firstname.substring(0,1)).concat(user.lastname.substring(0,2)).concat(user.customproperty40.substring(1,1))}\",

we need to create usernames based on some logics by using if else. lets say,

if user.costcentre=abc then ${user.country.substring(0,1).concat(user.locationnumber.substring(0,1)).concat(user.firstname.substring(0,1)).concat(user.lastname.substring(0,2)).concat(user.customproperty40.substring(1,1))}

if user.costcentre=xyz then **** and if user.costcentre= qwerty then ****

Could you please help me how to include if else condition to the existing username generation logic?

Thanks,

Bhargavi Padaraju.

1.And also, how can I use length function to retrieve last letter from the string. I tried in this way but thrown below error. 

\"username\":\"${user.country.substring(0,1).concat(user.locationnumber.substring(0,1)).concat(user.firstname.substring(0,1)).concat(user.lastname.substring(0,2)).concat(user.customproperty40.substring(user.customproperty40.length - 1))}\.

Logs :

Bhargavi3_0-1715067956022.png

2. Please confirm in rest connector createaccjson httpparams does index should start from 0 or 1. (I am confused what to mention)

Thanks,

Bhargavi

"httpParams": "{\"username\":\"${user.costcentre == 'abc' ? user.country.substring(0,1).concat(user.locationnumber.substring(0,1)).concat(user.firstname.substring(0,1)).concat(user.lastname.substring(0,2)).concat(user.customproperty40.substring(1,2)) : (user.costcentre == 'xyz' ? '****' : (user.costcentre == 'qwerty' ? '****' : ''))}\"}"


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Bhargavi3
New Contributor
New Contributor

Hi @rushikeshvartak, Thanks for your query. I am working on it.
Could you please let me know how can I retrieve the last letter from a string?
I am using this : concat(substring(user.customproperty40.length - 1))} but it is not working.

Thanks,

Bhargavi Padaraju.

user.customproperty40.charAt(user.customproperty40.length()- 1)


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.