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

Unable to send employeeid last digit in Create Account Json using Rest Connector

Bhargavi3
New Contributor III
New Contributor III

Hi Team,

We are trying to extract employeeid last digit. But we are unable to extract.

we used below logic:

user.employeeid.toString().slice(-1) did not work

user.employeeid%10  did not work in Create accountjson (but working in sql Account Name Rule)

user.employeeid.toString().substring(user.customproperty40.length() -1 ,user.customproperty40.length()) did not work

user.employeeid.toString().replace(/^.*(\d)$/, '$1')  extracting whole employeeid

could someone help me to extract with the syntax?

Thanks,

Bhargavi Padaraju.

10 REPLIES 10

NM
Esteemed Contributor
Esteemed Contributor

Hi @Bhargavi3 ,

Try this

user.employeeId.substring(user.emoloyeeId.length() -1 ,user.employeeId.ength())

 


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

rushikeshvartak
All-Star
All-Star

${user?employeeId.substring(user?employeeId.length() - 1)}


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

narayandas
New Contributor III
New Contributor III

Hi @NM & @rushikeshvartak ,
 

Thank you for your response. We have tried the test lists below, but they are not working 

Test1: ${user?employeeId.substring(user?employeeId.length() - 1)}
Test 2: user.employeeId.substring(user.emoloyeeId.length() -1 ,user.employeeId.ength())

Test 3: user.employeeId.toString().substring(user.employeeId.toString().length - 1)
 

Thanks,
Narayan Das

 

Could you kindly provide a detailed snapshot of the information extracted from the logs, encompassing errors and other pertinent functionality details encountered during the execution of this process? Your assistance in furnishing this information would greatly aid in the analysis and resolution of any issues .



‼️‼️⚠️Do not upload any attachments that contain sensitive information, such as IP Addresses, URLs, Company/Employee Names, Email Addresses, etc.⚠️‼️‼️


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

Hi @rushikeshvartak, we are using the below code

,\"customproperty10\":\"${if(user.comments.equals('Workday Imported')) {'s' + 'hq' + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid.toString().substring(user.employeeid.toString().length - 1)} else{if(user.employeeType.equals('Call Center') && user.location.equals('Malaysia')) {'cctd' + user.firstname.toString().toLowerCase().substring(0,4) + user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('Call Center') && user.location.equals('Philippines')){'cclc'+ user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('SQ Call Center') && user.location.equals('Malaysia')) {'sqcc' + user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('GLCC')) {'glcc'+ user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)}else{if(user.employeeType.equals('GSA')) {user.country.toString().toLowerCase().substring(0,2) + user.location.toString().toLowerCase().substring(0,2) + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid.toString().substring(user.employeeid.toString().length - 1)} else{if(user.employeeType.equals('Airport Requestor')) {user.country.toString().toLowerCase().substring(0,1) + user.location.toString().toLowerCase().substring(0,1) + user.customproperty12.toString().toLowerCase().substring(0,1) + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid.toString().substring(user.employeeid.toString().length - 1)} else{user.username}}}}}}}}\"}",

 

Test1: ${user?employeeId.substring(user?employeeId.length() - 1)}
Test 2: user.employeeId.substring(user.emoloyeeId.length() -1 ,user.employeeId.ength())

Test 3: user.employeeId.toString().substring(user.employeeId.toString().length - 1
 
we tried the above three logics but getting the below same error for all three.

The above code we are using, we are getting below error in the logs.

Bhargavi3_0-1722853863049.png

when we use user.employeeid it is working fine

\"customproperty10\":\"${if(user.comments.equals('Workday Imported')) {'s' + 'hq' + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid} else{if(user.employeeType.equals('Call Center') && user.location.equals('Malaysia')) {'cctd' + user.firstname.toString().toLowerCase().substring(0,4) + user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('Call Center') && user.location.equals('Philippines')){'cclc'+ user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('SQ Call Center') && user.location.equals('Malaysia')) {'sqcc' + user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('GLCC')) {'glcc'+ user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)}else{if(user.employeeType.equals('GSA')) {user.country.toString().toLowerCase().substring(0,2) + user.location.toString().toLowerCase().substring(0,2) + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid} else{if(user.employeeType.equals('Airport Requestor')) {user.country.toString().toLowerCase().substring(0,1) + user.location.toString().toLowerCase().substring(0,1) + user.customproperty12.toString().toLowerCase().substring(0,1) + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid} else{user.username}}}}}}}}

 

Seems like while we are trying to convert it to string and extract last digit we are getting error. if we give user.employeeid working fine.

Do we have any other option to extract last digit without converting to string?

Thanks,

Bhargavi Padaraju.

  • You have issue with your overall JSON
  • One of the dynamic variable is incorrect hence none of dynamic variables are evaluating
  • Share full JSON 

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

Raghu
All-Star
All-Star

@Bhargavi3  try below

${user.employeeid[user.employeeid?length - 1]}


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

Bhargavi3
New Contributor III
New Contributor III

Hi @rushikeshvartak , We dont have any error in Json, It is working fine if we give user.employeeid. It is throwing error when we add length() function in it. Please find the below Json code:

 

{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://domain.saviyntcloud.com/ECM/api/v5/createAccount ",
"httpMethod": "POST",
"httpParams": "{\"securitysystem\":\"Saviynt4Saviynt\",\"endpoint\":\"Saviynt4Saviynt\",\"name\":\"${user.username}\",\"username\":\"${user.username}\",\"requestor\":\"${user.username}\",\"accountowner\":[{\"type\":\"user\",\"value\":\"${user.username}\",\"rank\":\"1\"}],\"displayname\":\"${user.displayname}\",\"comments\":\"${user.comments}\",\"accountid\":\"${user.username}\",\"customproperty10\":\"${if(user.comments.equals('Workday Imported')) {'s' + 'hq' + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid[user.employeeid?length - 1]} else{if(user.employeeType.equals('Call Center') && user.location.equals('Malaysia')) {'cctd' + user.firstname.toString().toLowerCase().substring(0,4) + user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('Call Center') && user.location.equals('Philippines')){'cclc'+ user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('SQ Call Center') && user.location.equals('Malaysia')) {'sqcc' + user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)} else{if(user.employeeType.equals('GLCC')) {'glcc'+ user.firstname.toString().toLowerCase().substring(0,4)+ user.lastname.toString().toLowerCase().substring(0,1)}else{if(user.employeeType.equals('GSA')) {user.country.toString().toLowerCase().substring(0,2) + user.location.toString().toLowerCase().substring(0,2) + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid[user.employeeid?length - 1]} else{if(user.employeeType.equals('Airport Requestor')) {user.country.toString().toLowerCase().substring(0,1) + user.location.toString().toLowerCase().substring(0,1) + user.customproperty12.toString().toLowerCase().substring(0,1) + user.firstname.toString().toLowerCase().substring(0,1) + user.lastname.toString().toLowerCase().substring(0,2) + user.employeeid[user.employeeid?length - 1]} else{user.username}}}}}}}}\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
200,
201,
204,
205
]
}
}
]
}

 

Hi @Raghu , 

tried with your logic . but did not work same error we are getting in logs:

Bhargavi3_0-1722924041075.png

 

if we use only user.employeeid it is working fine. Seems like length() function is not working.

Please Let us know if we have any other logics to achieve this scenario.

Thanks,

Bhargavi Padaraju.

[This message has been edited by moderator to mask sensitive information]

NM
Esteemed Contributor
Esteemed Contributor

Hi @Bhargavi3 @narayandas ,

can you try this once and share logs if it doesn't work

user.employeeid.substring(user.employeeid.length() -1 ,user.employeeid.length())


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

Bhargavi3
New Contributor III
New Contributor III

Hi @NM , Thanks for the logic.
It's Working.

Regards,

Bhargavi Padaraju.