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

Substring under else condition of JSON not working

rahul_p
Regular Contributor II
Regular Contributor II

Hello,

We are doing AD provisioning, under connection create JSON, we tried below condition for samAccountName :

  1. "sAMAccountName": "${if(task.accountName.length()<20) {task.accountName} else {task.accountName.substring(task.accountName.length()-2,2)}}"
  2. "sAMAccountName": "${if(task.accountName.length()<20) {task.accountName} else {task.accountName.substring(-2,2)}}"

Both are not working and giving invalid argument issue.

Can anybody help here?

Regards,

Rahul

 

 

 

10 REPLIES 10

NM
Regular Contributor III
Regular Contributor III

Hi @rahul_p, can you give it a shot by using "size()" once

rahul_p
Regular Contributor II
Regular Contributor II

Hello @NM ,

Thank you for the response, tried the size() but its not working. Same Substring issue is coming.

Regards,

Rahul

CR
Regular Contributor III
Regular Contributor III

try below:

"sAMAccountName": "${if(task.accountName.length()<20) {task.accountName} else {task.accountName.substring(task.accountName,-2,2)}}"


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

rahul_p
Regular Contributor II
Regular Contributor II

Hello @CR ,

Thank you for the response but its not working.

Thanks!

rushikeshvartak
All-Star
All-Star

"sAMAccountName": "${if(task.accountName.length() < 20) { task.accountName } else { task.accountName.substring(0, 20) }}"


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

rahul_p
Regular Contributor II
Regular Contributor II

Hello @rushikeshvartak ,

Thank you for the response.

This what currently configured and with this we are facing duplicate samAccountName issue, so we want to take first 18 chars and concat with last 2 chars to make it unique.

Thanks!

naveenss
All-Star
All-Star

Hi @rahul_p 

Can you try below?

"sAMAccountName": "${if(task.accountName.length()<20) {task.accountName} else {task.accountName[0..(task.accountName.length()-2)]}}"

 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

rahul_p
Regular Contributor II
Regular Contributor II

Hello @naveenss ,

Thanks for the response but its failing with invalid argument.

Regards,

Rahul

Can you please share log snippet?

 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

rahul_p
Regular Contributor II
Regular Contributor II

Hello @naveenss ,

Checking DN for CN=SVC_todayisfirsttstaccount_techniallastnameuser,OU=<folder>,OU=<subDomain>,DC=<domain>,DC=com.Not FOund DN for CN=SVC_todayisfirsttstaccount_techniallastnameuser,OU=<folder>,OU=<subDomain>,DC=<domain>,DC=com. Error while creating account in AD - [LDAP: error code 80 - 00000523: SysErr: DSID-031A1242, problem 22 (Invalid argument), data 0 ]

 

Thanks,

Rahul