Send value as integer in CreateAccountJson in REST connector

Nimesh
New Contributor II
New Contributor II

Hi Team,

I have value coming from dynamic attribute as a combination of letters and number for eg. Agent-11190 . We want to send only the number as an integer in the CreateAccountJson (eg : 11190). Does anybody have any idea how to send the integer value from this string?

I am trying to get the number from the entire string using the below code however it is throwing an erorr since the number generated from below code is a String.

requestAccessAttributes.get('Profile').substring(requestAccessAttributes.get('Profile').lastIndexOf('-')+1)

Please assist.

Thanks & Regards,

Nimesh

7 REPLIES 7

pmahalle
Valued Contributor II
Valued Contributor II

Hi @Nimesh ,

Try below:

${Profile.substring(Profile.indexOf('-')+1)}


Regards,

Pandharinath Mahalle(Paddy)
If this reply answered your question, please Accept it As Solution to help others who may have a similar problem.

Nimesh
New Contributor II
New Contributor II

Hi Pandharinath,

This will give the result as String right? I want to convert this and send as an integer in the JSON.

Can you please guide me with the syntax for that?

Regards,

NImesh

pmahalle
Valued Contributor II
Valued Contributor II

@Nimesh Can you try above and check once.


Regards,

Pandharinath Mahalle(Paddy)
If this reply answered your question, please Accept it As Solution to help others who may have a similar problem.

Nimesh
New Contributor II
New Contributor II

Hi Pandharinath,

I have tried this and it is not working.

Please note that it is working fine if I use the same json with hardcoded profile id as \"profileId\": 15617

Regards,

Nimesh

Nimesh
New Contributor II
New Contributor II

Hi Pandharinath/Team,

Anybody has any inputs on this?

Regards,

Nimesh

SB
Saviynt Employee
Saviynt Employee

Can you try with the below and see if it converts the value to int

${Profile.substring(Profile.indexOf('-')+1).toInteger()}


Regards,
Sahil

Nimesh
New Contributor II
New Contributor II

Below config has worked for me.

\"profileId\":${requestAccessAttributes.get('Profile').substring(requestAccessAttributes.get('Profile').lastIndexOf('-')+1)}}]}

Note : Have this without double quotes for integer.