Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/17/2022 09:14 AM
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
Solved! Go to Solution.
06/17/2022 10:19 AM - edited 06/17/2022 10:24 AM
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
06/20/2022 01:05 AM - edited 06/20/2022 06:49 AM
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:
Can you help us?
Thank you,
Matteo
06/20/2022 07:37 AM
try
"httpParams":"{\"businessPhones\": [\"${user?.phonenumber==null? '': user?.phonenumber}\"]}",
if doesnot work then
"httpParams":"{\"businessPhones\": [\"${user?.phonenumber=='[]'? '': user.phonenumber}\"]}",
or try
.replaceAll('[,'').replaceAll(']','')
06/20/2022 10:07 AM
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!