Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Azure AD Account creation with business phones

JustSalva
Regular Contributor
Regular Contributor

Hi all, 

We are trying to integrate the standard AAD connector to create accounts populating the profile with the business phone of the user.

this is the json we are using:

{
"call":[
{
"name":"call1",
"connection":"userAuth",
"url":"https://graph.microsoft.com/v1.0/users/${account.accountID}",
"httpMethod":"PATCH",
"httpParams":"{\"surname\":\"${user.lastname}\",\"businessPhones\": [\"${user.businessPhone==null? '': user.businessPhone}\"],\"department\":\"${requestAccessAttributes.get('Test_1')}\"}",
"httpHeaders":{
"Authorization":"${access_token}"


},
"httpContentType":"application/json",
"successResponses":{
"statusCode":[
200,
201,
204,
205
]
}
}
]
}


 We are getting the following error:

Unrecognized token '$': was expecting ('true', 'false' or 'null')\n at [Source: {\"surname\":\"${user.lastname}\",\"businessPhones\":[${user.businessPhone==null? '':\"user.businessPhone\"}],

do you have any idea of why?

We need to enclose the phone parameter in square brackets because AAD expects a list in the parameter.

 

Kind regards,

Matteo

4 REPLIES 4

avinashchhetri
Saviynt Employee
Saviynt Employee

Matteo,

You can try the following :

\"businessPhones\": [\"${user?.phonenumber==null? '': user.phonenumber}\"]

There is no businessphone attribute in Saviynt so you will have to use phonenumber. However your error doesn't seem to stem from this usage, please share the full logs. Also what is Test_1, a dynamic attribute ?

 

Regards,

Avinash Chhetri

Regards,
Avinash Chhetri

yes, sorry, let's isolate the issue.

We tried the following: 

{
"call":[
{
"name":"call1",
"connection":"userAuth",
"url":"https://graph.microsoft.com/v1.0/users/${account.accountID}",
"httpMethod":"PATCH",
"httpParams":"{\"businessPhones\": [\"${user?.phonenumber==null? '': user.phonenumber}\"]}",
"httpHeaders":{
"Authorization":"${access_token}"


},
"httpContentType":"application/json",
"successResponses":{
"statusCode":[
200,
201,
204,
205
]
}
}
]
}

that works only if the secondaryphone field is populated, otherwise it populates the array with an empty string ( "businessPhones": [""] ) that is not accepted by azure; what we want is to post "businessPhones": [] if the value is null.

To that end we tried

 \"businessPhones\": [${user?.secondaryPhone==null? '': \"user.secondaryPhone\"}]

that works correctly if the value is null, but does not evaluate the secondary phone expression in the else clause, here you can find the logs:

JustSalva_0-1655712086363.png

Can you help us?

Thank you,

Matteo

try 

"httpParams":"{\"businessPhones\": [\"${user?.phonenumber==null? '': user?.phonenumber}\"]}",

if doesnot work then

"httpParams":"{\"businessPhones\": [\"${user?.phonenumber=='[]'? '': user.phonenumber}\"]}",

 or try

.replaceAll('[,'').replaceAll(']','')


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

I tried both

The first one does not work if the business phone is empty () cause it produces the string: "businessPhones": [""]  that is rejected by Azure with the following error: [{"code":"InvalidLength","message":"The businessPhones should be between 1 and 64 characters.","target":"businessPhones"}]

The second one instead works correctly, thank you!