and more in a single search tool across platforms. Read the announcement here. |
01/05/2023 08:00 AM
Hello,
I'm getting the below error when trying to provision an AD account. I've used a similar json for another connector but seem to be getting this error with slight modification for checking if the attribute is equal to null. My json is posted below. Any suggestions?
{
"sAMAccountName": "t${user?.username == null ? '' : user?.username}",
"displayName": "${user?.displayname == null ? '' : user?.displayname}",
"mail": "${user?.email == null ? '' : user?.email}",
"employeeid": "${user?.employeeid == null ? '' : user?.employeeid}",
"CannotChangePassword": "",
"l": "${user?.city == null ? '' : user?.city}",
"scriptPath": "default.bat",
"givenName": "${user?.firstname == null ? '' : user?.firstname}",
"sn": "${user?.lastname == null ? '' : user?.lastname}",
"objectclass": [
"top",
"person",
"organizationalPerson",
"user"
],
"userPrincipalName": "t${user?.systemUserName == null ? '' : user?.systemUserName}@test.com",
"company": "Test",
"description": "${user?.displayname == null ? '' : user?.displayname}",
"pwdLastSet": "0",
"department": "${user?.departmentname == null ? '' : user?.departmentname}",
"title": "${user?.title == null ? '' : user?.title}",
"homePhone": "${user?.phonenumber == null ? '' : user?.phonenumber}",
"streetAdress": "${user?.street == null ? '' : user?.street}",
"st": "${user?.street == null ? '' : user?.street}",
"postalcode": "${user?.regioncode == null ? '': user?.regioncode}",
"extensionAttribute1": "${user?.customproperty14 == null ? '' : user?.customproperty14}",
"extensionAttribute2": "${user?.customproperty15 == null ? '' : user?.customproperty15}",
"exofficelocation": "${user?.location == null ? '' : user?.location}",
"pager": "${user?.customproperty61 == null ? '' : user?.customproperty61}",
"userPassword": " ${randomPassword}",
"accountExpires": "0",
"userAccountControl": "66048",
"manager": "${managerAccount?.accountID == null ? '' : managerAccount?.accountID}"
}
Solved! Go to Solution.
01/05/2023 08:24 AM
Is there any reason why you are doing null check for almost all attributes? Did you face any issue in creating account without null check ?
Also can you try modifying manager mapping as below?
"manager": "${managerAccount==null?null:managerAccount.accountID}"
if it still didn't work and you need to do null check on all attributes then change your null check as below
Ex: "displayName": "${user.displayname==null?null:user.displayname}"
01/05/2023 10:22 AM
No reason, I was checking as I kept getting the same error message without the null check.
I tried your modification below and still getting the same error. Below is the modified JSON.
{
"sAMAccountName": "t${user?.username==null?null:user?.username}",
"displayName": "${user?.displayname==null?null:user?.displayname}",
"mail": "${user?.email}",
"employeeid": "${user?.employeeid}",
"CannotChangePassword": "",
"l": "${user?.city}",
"scriptPath": "default.bat",
"givenName": "${user?.firstname==null?null:user?.firstname}",
"sn": "${user?.lastname==null?null:user?.lastname}",
"objectclass": [
"top",
"person",
"organizationalPerson",
"user"
],
"userPrincipalName": "t${user?.systemUserName==null?null:user?.systemUserName}@test.com",
"company": "Test",
"description": "${user?.displayname}",
"pwdLastSet": "0",
"department": "${user?.departmentname}",
"title": "${user?.title}",
"homePhone": "${user?.phonenumber}",
"streetAdress": "${user?.street}",
"st": "${user?.street}",
"postalcode": "${user?.regioncode}",
"extensionAttribute1": "${user?.customproperty14}",
"extensionAttribute2": "${user?.customproperty15}",
"exofficelocation": "${user?.location}",
"pager": "${user?.customproperty61}",
"userPassword": " ${randomPassword}",
"accountExpires": "0",
"userAccountControl": "66048",
"manager": "${managerAccount==null?null: managerAccount.accountID}"
}
01/05/2023 10:41 AM
I m not sure if it is typo error while pasting in forum or same you have used in connector. Can you make sure that you have don't have "t" in samaccountname mapping ? If you have then try to remove it and try again?
"sAMAccountName": "t${user?.username==null?null:user?.username}",
01/05/2023 10:47 AM
I'll need the t in there as my client adds a t to the start of an admin account, which I'm trying to test provisioning for. Is the way I am doing the t a syntax error?
The AD domain for both connections is the same but the other is for regular accounts and not admin accounts.
01/05/2023 11:13 AM
Then try like below
"sAMAccountName": "${'t'+ (user?.username==null?null:user?.username)}",
01/05/2023 12:52 PM - edited 01/05/2023 12:53 PM
Tried your suggestion but still seem to be getting the same error as above. See below json. Not sure what the cause is.
{
"sAMAccountName": "${'t' + (user?.username==null?null:user?.username)}",
"displayName": "${user?.displayname==null?null:user?.displayname}",
"mail": "${user?.email}",
"employeeid": "${user?.employeeid}",
"CannotChangePassword": "",
"l": "${user?.city}",
"scriptPath": "default.bat",
"givenName": "${user?.firstname==null?null:user?.firstname}",
"sn": "${user?.lastname==null?null:user?.lastname}",
"objectclass": [
"top",
"person",
"organizationalPerson",
"user"
],
"userPrincipalName": "${'t' + (user?.systemUserName==null?null:user?.systemUserName) + '@test.com'}",
"company": "Test",
"description": "${user?.displayname}",
"pwdLastSet": "0",
"department": "${user?.departmentname}",
"title": "${user?.title}",
"homePhone": "${user?.phonenumber}",
"streetAdress": "${user?.street}",
"st": "${user?.street}",
"postalcode": "${user?.regioncode}",
"extensionAttribute1": "${user?.customproperty14}",
"extensionAttribute2": "${user?.customproperty15}",
"exofficelocation": "${user?.location}",
"pager": "${user?.customproperty61}",
"userPassword": "${randomPassword}",
"accountExpires": "0",
"userAccountControl": "66048",
"manager": "${managerAccount==null?null: managerAccount.accountID}"
}
01/05/2023 02:09 PM
Try similar json with few mandatory attributes
01/05/2023 02:19 PM
Try below JSON, I see that for streetAddress you have used wrong parameter I changed that and also removed some of the field mappings. If below works you can add one by one to see which one is causing issue.
{
"sAMAccountName": "${'t' + (user?.username==null?' ':user?.username)}",
"displayName": "${user?.displayname==null?null:user?.displayname}",
"mail": "${user?.email}",
"employeeID": "${user?.employeeid}",
"l": "${user?.city}",
"givenName": "${user?.firstname==null?null:user?.firstname}",
"sn": "${user?.lastname==null?null:user?.lastname}",
"objectClass": [
"top",
"person",
"organizationalPerson",
"user"
],
"userPrincipalName": "${'t' + (user?.systemUserName==null?null:user?.systemUserName) + '@test.com'}",
"pwdLastSet": "0",
"department": "${user?.departmentname}",
"title": "${user?.title}",
"homePhone": "${user?.phonenumber}",
"streetAddress": "${user?.street}",
"st": "${user?.street}",
"postalCode": "${user?.regioncode}",
"extensionAttribute1": "${user?.customproperty14}",
"extensionAttribute2": "${user?.customproperty15}",
"pager": "${user?.customproperty61}",
"userPassword": "${randomPassword}",
"accountExpires": "0",
"userAccountControl": "66048",
"manager": "${managerAccount==null?null: managerAccount.accountID}"
}