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

Replave value in CreateAccountJSON

JPMac
Regular Contributor
Regular Contributor

Hi all, 

I'm creating a create account json for AD and I put ${user.displayname} in "displayname."
So I want to convert the character of user.displayname to another character by regular expression.

===createaccountjson===

{
"userPrincipalName": "${user.username+'@<domainname>'}",
"displayname": "${user.displayname.replace(/[\u3041-\u3096]/g,function(match) {return String.fromCharCode(match.charCodeAt(0)+0x60);})}",
"objectClass": [
"top",
"person",
"organizationalPerson",
"user"
],
"pwdLastSet": "0",
"sAMAccountName": "${task.accountName}",
"userAccountControl": "544",
"description": "Account provisioned by Saviynt"
}

======================


However, when I execute Job, I get the following error:

===error===

Checking DN for CN=xxx,OU=Users,OU=Lab,DC=xxx,DC=xxx.Not FOund DN for CN=xxx xxx,OU=Users,OU=Lab,DC=xxx,DC=xxx. Error while creating account in AD - nullChecking DN for CN=xxx,OU=Users,OU=Lab,DC=macsaviynt,DC=local.Not FOund DN for CN=xxx xxx,OU=Users,OU=Lab,DC=xxx,DC=xxx. Error while creating account in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript16840.groovy: 3: unexpected token: g @ line 3, column 68. name.replace(/[\u3041-\u3096]/g,function ^ 1 error Checking DN for CN=xxx xxx,OU=Users,OU=Lab,DC=xxx,DC=xxx. Not FOund DN for CN=xxx xxx,OU=Users,OU=Lab,DC=xxx,DC=xxx. Error while creating account in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript16858.groovy: 3: unexpected token: g @ line 3, column 68. name.replace(/[\u3041-\u3096]/g,function ^ 1 error

==========


Can you give me some advice?

 

 

 

 

5 REPLIES 5

rushikeshvartak
All-Star
All-Star

Sample Example :

${user.displayname.replaceAll("\\s+\\", "-")}


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

Manu269
All-Star
All-Star

@JPMac This is somthing i did in past for comments attribute :

${task.requestKey==null?'':task.requestKey?.comments?.replaceAll('<.*?>','').replaceAll('\\n','').replaceAll('\\r','').replaceAll('[^ -~À-ÿ]+','').replaceAll(new String('XFw='.decodeBase64()),new String('XFxcXA=='.decodeBase64()))}

Can you try checking something similar can help you.

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.

JPMac
Regular Contributor
Regular Contributor

@Manu269 @rushikeshvartak 

Thanks for your comment.

Based on your comment, I changed the writing style as follows, but it's not working.

${user.displayname.replaceAll(/[\u3041-\u3096]/, match => String.fromCharCode(match.codePointAt(0) + 0x60))}

Can you give me any advices?

what is error


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

JPMac
Regular Contributor
Regular Contributor

in Log viewer

====

084 [quartzScheduler_Worker-3] ERROR ldap.SaviyntGroovyLdapService - Error while creating account XXX in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:\n"

===

in Task comment

===

Checking DN for CN=XXX,OU=Users,OU=YYY,DC=ZZZ,DC=ZZZ.Not FOund DN for CN=XXX,OU=Users,OU=YYY,DC=ZZZ,DC=ZZZ. Error while creating account in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript16893.groovy: 3: unexpected token: > @ line 3, column 116. All(/[\u3041-\u3096]/, match => String.f ^ 1 error Checking DN for CN=XXX,OU=Users,OU=YYY,DC=ZZZ,DC=ZZZ.Not FOund DN for CN=XXX,OU=Users,OU=YYY,DC=ZZZ,DC=ZZZ. Error while creating account in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript16894.groovy: 3: unexpected token: > @ line 3, column 80. All(/[\u3041-\u3096]/, match => String.f ^ 1 error Checking DN for CN=XXX,OU=Users,OU=YYY,DC=ZZZ,DC=ZZZ.Not FOund DN for CN=XXX,OU=Users,OU=YYY,DC=ZZZ,DC=ZZZ. Error while creating account in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript16895.groovy: 3: unexpected token: > @ line 3, column 80. All(/[\u3041-\u3096]/, match => String.f ^ 1 error
===