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

how to write null condition in ad updateaccount json

sbiswal
New Contributor II
New Contributor II

Hello,

 we have a usecase where we only want the attribute to be updated if there's a null value/ or if it is not populated by a 'noupdate' value in a customproperty10. what should be the syntax for that?

So far, I've tried these:

"l":"${if(account.customproperty10.isEmpty()) ${user?.city}}",

"l": "${if(account.customproperty10.equalsIgnoreCase('')) ${user?.city}}"

"l": "${if(account.customproperty10.equals('')) ${user?.city}}"

"l":"${if(account.customproperty10 ==null)${user?.city}}"

"l":"${if((account.customproperty10 === null ? '' : account.customproperty10) === user.city)(SAVIYNTNOTCHANGED) else {user?.city}}"

"department":"${if(account.customproperty10 !=null) else ${user?.departmentname}}"

"l": "${if(account.customproperty10 != 'noupdate'))${user.city}}",

All of these are giving me error. Is there any other syntax i can use?

Thanks in advance!

7 REPLIES 7

DixshantValecha
Saviynt Employee
Saviynt Employee

I appreciate you reaching out to the Saviynt forums.

To update the attribute only if it is null or not populated with a "noupdate" value in customproperty10, you can use the following syntax:

syntax:- "l":"${if(account.customproperty10 == null || account.customproperty10.equalsIgnoreCase('noupdate')) ${user?.city} else account.customproperty10}"

This syntax checks if account.customproperty10 is null or equal to "noupdate". If either condition is true, it updates the attribute with the value of user.city. Otherwise, it keeps the existing value of account.customproperty10.

I hope this helps! Let me know if you have any further questions.

Hello,

Thanks for the code. However, I am getting the below error on it:

Error while Update operation for account-Tousif in AD - No such property: customproperty10 for class: java.lang.String

Would you have any input on what his error means? Is it syntax related or something else?

Thank you,

Seemran Biswal

Looks like when CPxx didn't have values it is not even exposed. You may have to assign some default value to respective CPxx to achieve your logic.

Just confirm the same try to update cp10 with value Test and change the logic to below and see if it works

"l":"${if (account.customproperty10=='Test' || !(account.customproperty10.equalsIgnoreCase('noupdate'))) {user?.city}}}"


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

sbiswal
New Contributor II
New Contributor II

Hello,

Thanks for the suggestion. I tried your approach, and then different variations of that, using the variable update instead of test, but it still gave me the same error for some reason.

Do you have any other reason/ approach to this?

Thanks

sk
All-Star
All-Star

Try below mapping

"l":"${if (null == account.customproperty10 || account.customproperty10=='' || !(account.customproperty10.equalsIgnoreCase('noupdate'))) {user?.city}}}"


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

DixshantValecha
Saviynt Employee
Saviynt Employee

Thanks for the update,Kindly try below mapping and let us know if further assistance is needed from our end.

 mapping

"l":"${if (null == account.customproperty10 || account.customproperty10=='' || !(account.customproperty10.equalsIgnoreCase('noupdate'))) {user?.city}}}"

DixshantValecha
Saviynt Employee
Saviynt Employee

Thanks for the update, Kindly try below mapping and let us know if further assistance is needed from our end.

First mapping:-

"l": "${account.customproperty10 == null || account.customproperty10 != 'noupdate' ? user?.city : 'SAVIYNTNOTCHANGED'}"

Second:-

"l": "${((account.customproperty10 == null || account.customproperty10.isEmpty()) && account.customproperty10 != 'noupdate') ? user?.city : account.customproperty10}"