Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Need to update username with if else condition

Varshi_Balaji
Regular Contributor
Regular Contributor

Hi Team,

We have a requirement where we need to update username based on employeeid.

This is the logic: "httpParams": "{\"updatedusername\":\"${user?.customproperty65}\",\"employeeid\":\"${user?.employeeid}\",\"propertytosearch\":\"employeeid\"}",

But for our requirement some users have  employeeid as null,so we need to check other cp24.So I have added if else condition in property to search

"httpParams": "{\"updatedusername\":\"${user?.customproperty65}\",\"propertytosearch\":\"${(user?.employeeid == null) ? user?.customproperty24 : user?.employeeid}\",\"employeeid\":\"${user?.employeeid}\",\"customproperty24\":\"${user?.customproperty24}\"}",

This is not working and username is not updating if employeeid is null and cp24 has value.

Can you please suggest any other methos where w can achieve this.

Regards,

Varshitha

5 REPLIES 5

adriencosson
Valued Contributor
Valued Contributor

Hi @Varshi_Balaji,

In order to help you troubleshoot, are you using Saviynt4Saviynt Rest connector to update the identity's username in Saviynt ?

Note that in your second JSON, you're indicating in propertytosearch the following :

${(user?.employeeid == null) ? user?.customproperty24 : user?.employeeid}

This means that "If employeeid is null, then use the identity's customproperty24. Else use the identity's employeeid".

However, propertytosearch expects to have the column name to use for searching the user to update.

Therefore, I suggest you to use the below :

${(user?.employeeid == null) ? 'customproperty24' : 'employeeid'}

Hope this helps !

Regards,
Adrien COSSON

Hi Adrien,

Please find the attached update user json

{
"actions": {
"Update Login": {
"call": [
{
"name": "updateusercp",
"connection": "userAuth",
"url": "https://test.saviyntcloud.com/ECM/api/v5/updateUser",
"httpMethod": "POST",
"httpContentType": "application/json",
"httpParams": "{\"updatedusername\":\"${user?.customproperty65}\",\"propertytosearch\":\"${(user?.employeeid == null) ? 'customproperty24' : 'employeeid'}\",\"employeeid\":\"${user?.employeeid}\",\"customproperty24\":\"${user?.customproperty24}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"successResponses":
{
"message": "User Updated Successfully",
"statusCode": "200,201"
}
}
]
}
}
}

 

I tried the above condition but it is not working, username did not update.

Regards,

Varshitha

adriencosson
Valued Contributor
Valued Contributor

Hi @Varshi_Balaji,

I did try through Postman and was able to perform successful changes on the identity's Username using the below JSON sample data

{
    "propertytosearch": "customproperty24",
    "updatedusername": "NewUsername1",
    "customproperty24" : "sampleValue"
}

Any chance you can let me know the following :

  • Is the task being completed in Saviynt but no action is taken ?
    • If yes : Have you configured a Security System and attached the connection that includes your Update User JSON ?
    • If not : Can you share the logs when provisioning runs ?

 

Regards,
Adrien COSSON

Varshi_Balaji
Regular Contributor
Regular Contributor

Hi Adrien,

I tested again and above logic works. Thank you for the support.

Regards,

Varshitha

adriencosson
Valued Contributor
Valued Contributor

Happy this helped resolved your case !

Drop a Kudo if you have time 😉

Regards,
Adrien COSSON