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

Error in JSON while creating account in AD

TheSaviyntBoy
Regular Contributor
Regular Contributor

Hi,

I am trying to provision an account in AD. It is showing me the following error: 

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: SimpleTemplateScript40964.groovy: 13: expecting '}', found '.' @ line 13, column 208. feredFirstName:user.firstname}.${user.la ^ 1 error

I can understand it is coming because of the sAMAccountName field because of if-else. Can anyone guide me what can be the right format?

CreateAccountJSON: 

{
"accountExpires": "0",
"co": "${user.country}",
"company": "Static Company Name",
"department": "${user.departmentname}",
"description": "Created through Saviynt",
"displayname": "${user.preferedFirstName!=null?user.preferedFirstName:user.firstname} ${user.lastname}",
"employeeNumber": "${user.customproperty1}",
"employeeType": "${user.employeeType}",
"givenName": "${user.preferedFirstName!=null?user.preferedFirstName:user.firstname}",
"l": "${user.city}",
"mail": "${user.preferedFirstName!=null?user.preferedFirstName:user.firstname}.${user.lastname}@domain.com",
"sAMAccountName": "${ if(user?.departmentname.contains('Test dept2')){concat(user.firstname,'.',SUBSTRING(user.lastname, 1, 1))}else{user.preferedFirstName!=null?user.preferedFirstName:user.firstname}.${user.lastname}}",
"sn": "${user.lastname}",
"st": "${user.state}",
"title": "${user.title}",
"manager": "${managerAccount.comments}",
"userPrincipalName": "${user.username}@domain.com",
"userAccountControl": 512,
"pwdLastSet": "0",
"physicalDeliveryOfficeName": "${user.location}",
"objectClass": [
"top",
"person",
"organizationalPerson",
"user"
]
}

 

Thank you. 

1 REPLY 1

rushikeshvartak
All-Star
All-Star

"sAMAccountName": "${user.departmentname.contains('Test dept2') ? concat(user.firstname,'.',SUBSTRING(user.lastname, 0, 1)) : (user.preferedFirstName != null ? user.preferedFirstName : user.firstname) + '.' + user.lastname}"


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