and more in a single search tool across platforms. Read the announcement here. |
04/05/2024 04:24 AM
Hi Team,
We are using sav4savrest connector to update the displayname attribute and we have preprocessor query and updateuserjson
we created the updateuser task and those tasks are completed but updates are not pushed to user.
We are using below updateuserjson
"httpParams": "{\"username\":\"${user?.username}\",\"displayname\":\"${if(user?.employeetype=='Permanent Employee' && user?.entity is null){firstname+''+lastname}else if(user?.employeetype=='Permanent Employee' && user?.customproperty3='89' && user?.entity is null){firstname+''+lastname+'External'}else if(user?.employeetype=='Permanent Employee' && user?.entity is null){firstname+''+lastname+'Externe'}}\"}",
Please help us on this issue.
Thanks,
Sai Meghana
04/05/2024 04:27 AM
Please share full json
04/05/2024 04:30 AM
Hi Rushikeshvartak,
Please find the below json
{
"actions": {
"Update Login": {
"call": [
{
"name": "updateusercp",
"connection": "userAuth",
"url": "https://abc.saviyntcloud.com/ECM/api/v5/updateUser",
"httpMethod": "POST",
"httpContentType": "application/json",
"httpParams": "{\"username\":\"${user?.username}\",\"displayname\":\"${if(user?.employeetype=='Permanent Employee' && user?.entity is null){firstname+''+lastname}else if(user?.employeetype=='Permanent Employee' && user?.customproperty3='89' && user?.entity is null){firstname+''+lastname+'External'}else if(user?.employeetype=='Permanent Employee' && user?.entity is null){firstname+''+lastname+'Externe'}}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"successResponses": {
"message": "User Updated Successfully",
"statusCode": "200,201"
}
}
]
}
}
}
Thanks,
Sai Meghana
04/05/2024 04:32 AM
{
"actions": {
"Update Login": {
"call": [
{
"name": "Update Login",
"connection": "userAuth",
"url": "https://abc.saviyntcloud.com/ECM/api/v5/updateUser",
"httpMethod": "POST",
"httpContentType": "application/json",
"httpParams": "{\"username\":\"${user?.username}\",\"displayname\":\"${if(user?.employeetype=='Permanent Employee' && user?.entity is null){firstname+''+lastname}else if(user?.employeetype=='Permanent Employee' && user?.customproperty3='89' && user?.entity is null){firstname+''+lastname+'External'}else if(user?.employeetype=='Permanent Employee' && user?.entity is null){firstname+''+lastname+'Externe'}}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"successResponses": {
"message": "User Updated Successfully",
"statusCode": "200,201"
}
}
]
}
}
}
04/05/2024 04:46 AM
Tried with these json, still it's not updating in user
04/05/2024 04:47 AM
Enable additional logs and validate parameters getting sent
showlogs - true in configjson
04/05/2024 10:36 AM
Added the config json and tried, in Logs we ca see all the attributes are passing and we don't see any error in logs.
04/08/2024 03:49 AM
Hi,
We tried and fetched the logs we didn't see any error in logs.
Please can we have some update on this issue.
Thanks,
Sai Meghana
04/09/2024 12:16 PM
Hi @rushikeshvartak .
Thank you for the support, the above issue is resolved. There was a bracket missing and we added. it is working now.
We need to add "AND" condition.we tried '&&','&',and,AND. but it is not working.
do you have any example how to use and condition in if else.
Eg: "httpParams": "{\"username\":\"${user?.username}\",\"displayname\":\"${if(user?.employeetype=='Permanent Employee' and user?.customproperty3=='89'){user?.firstname+' '+user?.lastname}else{'test'}}\"}",
Regards,
Varshitha
04/09/2024 12:50 PM
Hi @Varshi_Balaji ,
Can you try the below:
${'Permanent Employee'.equals(user?.employeeType) && user.customproperty3=='89' ? [{user?firstname + user?lastname}] : [{'Test'}]}
If this helps your question, please consider selecting Accept as Solution and hit Kudos
04/09/2024 01:04 PM - edited 04/09/2024 01:07 PM
"httpParams": "{\"username\":\"${user?.username}\",\"displayname\":\"${(user?.employeetype == 'Permanent Employee' && user?.customproperty3 == '89') ? user?.firstname + ' ' + user?.lastname : 'test'}\"}",
04/10/2024 01:38 AM
Hi @rushikeshvartak .
The solution is working. Thank you for the support.
We need to add multiple conditions in the ternary operator. But it is not working.
"httpParams": "{\"username\":\"${user?.username}\",\"displayname\":\"${(user?.employeeType == 'Permanent Employee' && user?.entity==null) ? user?.firstname + ' ' + user?.lastname : (user?.employeeType!='Permanent Employee' && user?.customproperty3='89') ? user?.firstname+' '+user?.lastname : 'test'}\"}",
- This is the condition I added.The condition in bold is not working. and if I'm adding only one condition like (user?.employeeType!='Permanent Employee') ? user?.firstname - this is working.
Can you please help us here to add multiple condition and can you suggest me if I'm adding the syntax in incorrect way.
Regards,
Varshitha
04/10/2024 09:11 PM
"httpParams": "{\"username\":\"${user?.username}\",\"displayname\":\"${(user?.employeeType == 'Permanent Employee' && user?.entity == null) ? user?.firstname + ' ' + user?.lastname : (user?.employeeType != 'Permanent Employee' && user?.customproperty3 == '89') ? user?.firstname + ' ' + user?.lastname : 'test'}\"}"
04/11/2024 03:46 AM
Yes,Updated in the same format and it is working.
Regards,
Varshitha
Varshitha
04/11/2024 05:18 AM
Please click the 'Accept As Solution' button on the reply (or replies) that best answered your original question.