Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/02/2024 03:05 AM
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.
Solved! Go to Solution.
08/02/2024 03:28 AM - edited 08/02/2024 03:39 AM
Hi @Bhargavi3 ,
Try this
user.employeeId.substring(user.emoloyeeId.length() -1 ,user.employeeId.ength())
08/02/2024 03:36 AM
${user?employeeId.substring(user?employeeId.length() - 1)}
08/05/2024 01:17 AM - edited 08/05/2024 01:23 AM
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())
Thanks,
Narayan Das
08/05/2024 02:10 AM
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.⚠️‼️‼️
08/05/2024 03:56 AM
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())
The above code we are using, we are getting below error in the logs.
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.
08/05/2024 06:41 PM
08/05/2024 05:58 AM
@Bhargavi3 try below
${user.employeeid[user.employeeid?length - 1]}
08/05/2024 11:01 PM - last edited on 08/05/2024 11:05 PM by Sunil
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:
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]
08/05/2024 11:09 PM
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())
08/05/2024 11:51 PM