Azure AD account creation with othermails

saramohanraj
New Contributor
New Contributor

Hi,

 

We are trying to create azure ad account with othermails attribute. But facing issues. We are using the below json for account creation, but it looks like the json is not populating the actual values instead it is sending the actual json. Can anyone please help to fix this error ASAP. without the othermails attribute, account creation works perfectly.

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

JSON:
"httpParams": "{\"accountEnabled\":true,\"displayName\":\"${user.lastname},${user.firstname}(${user.companyname})[${accountName}]\",\"mailNickname\":\"${account}\",\"userPrincipalName\":\"${account}@woodsideenergydev.onmicrosoft.com\",\"EmployeeID\":\"${user.employeeid}\",\"otherMails\": [\"${user?.email}\"],\"employeetype\":\"${user.employeeType}\",\"givenName\":\"${user.preferedFirstName}\",\"companyName\":\"${user.companyname}\",\"department\":\"${user.departmentname}\",\"employeeHireDate\":\"${user.startdate}\",\"passwordProfile\":{\"forceChangePasswordNextSignIn\":true,\"password\":\"${password}\"}}"

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

Error:

Got showLogs = true
2023-07-06/10:22:51.585 [{}] [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService - Calling Webservice Url - https://graph.microsoft.com/v1.0/users with httpParams - [accountEnabled:true, displayName:${user.lastname},${user.firstname}(${user.companyname})[${accountName}], mailNickname:${account}, userPrincipalName:${account}@woodsideenergydev.onmicrosoft.com, EmployeeID:${user.employeeid}, otherMails:[${user?.email=='[]'? '': user.email}], employeetype:${user.employeeType}, givenName:${user.preferedFirstName}, companyName:${user.companyname}, department:${user.departmentname}, employeeHireDate:${user.startdate}, password=******
2023-07-06/10:22:51.585 [{}] [quartzScheduler_Worker-4] DEBUG services.HttpClientUtilityService - isFipsEnabled = false
2023-07-06/10:22:51.585 [{}] [quartzScheduler_Worker-4] DEBUG services.HttpClientUtilityService - getHttpClient - sslParams : null
2023-07-06/10:22:51.585 [{}] [quartzScheduler_Worker-4] DEBUG services.HttpClientUtilityService - getHttpClient - proxyParams : null
2023-07-06/10:22:51.585 [{}] [quartzScheduler_Worker-4] DEBUG services.HttpClientUtilityService - getHttpClient - sslSocketFactory : null
2023-07-06/10:22:51.585 [{}] [quartzScheduler_Worker-4] DEBUG services.HttpClientUtilityService - setting connection timeout to 10 seconds and request timeout to 60 seconds
2023-07-06/10:22:51.585 [{}] [quartzScheduler_Worker-4] DEBUG services.HttpClientUtilityService - getHttpClient - HttpClientBuilder.create().build() called.
2023-07-06/10:22:51.636 [{}] [quartzScheduler_Worker-4] DEBUG rest.RestUtilService - Got showLogs = true
2023-07-06/10:22:51.636 [{}] [quartzScheduler_Worker-4] DEBUG rest.RestProvisioningService - Got Webservice API Response: [headers:[Cache-Control: no-cache, Transfer-Encoding: chunked, Content-Type: application/json, Vary: Accept-Encoding, Strict-Transport-Security: max-age=31536000, request-id: 00c1032b-2489-43d0-974e-489a22258496, client-request-id: 00c1032b-2489-43d0-974e-489a22258496, x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Australia East","Slice":"E","Ring":"5","ScaleUnit":"000","RoleInstance":"SY3PEPF000043FC"}}, x-ms-resource-unit: 1, Date: Thu, 06 Jul 2023 10:22:50 GMT], responseText:{"error":{"code":"Request_BadRequest","message":"Invalid datetime value: ${user.startdate}","innerError":{"date":"2023-07-06T10:22:51","request-id":"00c1032b-2489-43d0-974e-489a22258496","client-request-id":"00c1032b-2489-43d0-974e-489a22258496"}}}, cookies:[], statusCode:400]

 

 

Any kind of help is much appreciated. Its bit urgent. TIA.

Marking @rushikeshvartak @sahil for immediate assistance.

7 REPLIES 7

sahil
Saviynt Employee
Saviynt Employee

Can you try without ? in the variable ${user.email}


Regards,
Sahil

saramohanraj
New Contributor
New Contributor

 Hi Sahil,

Tried with the below, it works fine whenever the user has email address. but throwing error if the email is null

\"otherMails\": [\"${user?.email=='[]'? ' ': user.email}\"]

If the email in user attribute is null, it is passing as [null] instead of []. Could you please help

\"otherMails\": [\"${user?.email==null? ' ': user.email}\"]

Hi I tried this as well.

Though in logs i can see it is sending othermails:[], it is throwing error in log saying invalid email for othermails. but the same works in postman. Not sure why.

Hi I tried this as well.

Though in logs i can see it is sending othermails:[], it is throwing error in log saying invalid email for othermails. but the same works in postman. Not sure why.

 

json tried:  \"otherMails\": [\"${user?.email==null? ' ': user.email}\"] 

 

Error: Got Webservice API Response: [headers:[Cache-Control: no-cache, Transfer-Encoding: chunked, Content-Type: application/json, Vary: Accept-Encoding, Strict-Transport-Security: max-age=31536000, request-id: 0b3abd2b-0261-4501-bb84-4b6dce878b07, client-request-id: 0b3abd2b-0261-4501-bb84-4b6dce878b07, x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Australia East","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"SY2PEPF0000208A"}}, x-ms-resource-unit: 1, Date: Wed, 12 Jul 2023 06:18:12 GMT], responseText:{"error":{"code":"Request_BadRequest","message":"Invalid value specified for property 'otherMails' of resource 'User'.","details":[{"code":"InvalidLength","message":"The otherMails should be between 1 and 256 characters.","target":"otherMails"}],"innerError":{"date":"2023-07-12T06:18:12","request-id":"0b3abd2b-0261-4501-bb84-4b6dce878b07","client-request-id":"0b3abd2b-0261-4501-bb84-4b6dce878b07"}}}, cookies:[], statusCode:400]

 

Values sent :
Calling Webservice Url - https://graph.microsoft.com/v1.0/users with httpParams - [accountEnabled:true, displayName:xxxxxxxxxx, mailNickname:XMP.OA03385, userPrincipalName:xxxxxxxx.onmicrosoft.com, employeetype:FT, givenName:xxx, otherMails:[], employeeID:xxxx, companyName:xxxxx, department:Logistics, employeeHireDate:2019-12-02 00:00:00.0, password=******

 

json working in Postman:
{"accountEnabled": "true", "displayName": "devtest", "userPrincipalName":"xxxxxx.onmicrosoft.com","mailNickname":"devtest","employeeID":"xxx","givenName":"dev","otherMails":[],"companyName":"xxx","department":"sss","employeetype":"ttt",
"passwordProfile":
{"forceChangePasswordNextSignIn":true,
"password":"xxx"
}
}

\"otherMails\": \"${user?.email==null? ' ': user.email}\"

Hi @saramohanraj ,

      PLease add the confition for null too. "${user?.email== null?'':user?.user.email"

 

Thanks

Kishore