Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/21/2024 10:32 AM
Hi Team,
We are using the update user json in Rest connector to update the Username, we added the below query to copy the cp65 value to username attribute in saviynt by checking the employeeid and systemusername condition.
We are using the user update rules to call the connection and it will create the update user task, once that task completes it will update the username.
Issue: The Provisioning job is completing the update user task to update the username, but it is updating the employeeid along with username to "null".
Query:
{\"updatedusername\":\"${user?.customproperty65}\",\"propertytosearch\":\"${(user?.entity =='WW SuccessFactors') ? 'systemUserName' : 'employeeid'}\",\"employeeid\":\"${if(user?.employeeid!=null){user?.employeeid} else {}}\",\"systemUserName\":\"${if(user?.systemUserName!=null){user?.systemUserName} else {}}\"}"
we tried with different else condition still it is updating null in employeeid.
1) else null, -- pushing Null
2) else {}, -- pushing Null
3) else {null} -- pushing Null
Please could you help us on this issue asap.
Thanks,
Sai Meghana
Solved! Go to Solution.
06/21/2024 01:42 PM
Hi @saimeghana , why are you passing employee id field?? If ideally only username update is required?
06/22/2024 06:27 AM
Those 2 fields are unique attributes, so to differentiate the type of users we used the employeeid and systemusername fields.
06/21/2024 02:32 PM
What is stored in cp65 ?
06/22/2024 06:21 AM
cp65 will have the username, we are copying the cp65 to username
06/23/2024 12:42 PM - edited 06/23/2024 12:46 PM
Hi @saimeghana ,
have you tried it this way, don't construct the param when values are null.
{\"propertytosearch\":\"${(user?.entity =='WW SuccessFactors') ? 'systemUserName' : 'employeeid'}\" ${if(user?.customproperty65 != null){',\"updatedusername\":\"'+user?.customproperty65+'\"'} else {''}} ${if(user?.employeeid != null){',\"employeeid\":\"'+user?.employeeid+'\"'} else {''}}}"
You can extend this to contrute REST of your JSON, but the main part is , you don't construct {"username" : "cp65"} if cp65 doesn't exist. This method will create a JSON output like :
Case 1 : if cp65 is null and employeeID is not null.
{\"propertytosearch\":"employeeid", "employeeid":\"employeeid\":\"'+user?.employeeid+'\"}
Case 2 : if cp65 and employeeID both not null thn
{\"propertytosearch\":"employeeid",\"updatedusername\":\"'+user?.customproperty65+'\", "employeeid":\"employeeid\":\"'+user?.employeeid+'\"}
Case 3 both null
{\"propertytosearch\":"employeeid"}
This will only include the key - value pair if the value/condition is not null.
Thanks,
Amit