Click HERE to see how Saviynt Intelligence is transforming the industry. |
02/28/2023 09:03 AM
Hello,
We have a use case where some attributes should be updated if a certain customproperty has a certain value, and other attributes should be updated if the value is different or blank.
i've tried achieving this through if else scenario, with a few different syntaxes:
SYNTAX 1)
{${if customproperty10.equalsIgnoreCase('noupdate')
'\"givenname\": \"${if(user.firstname !=null) {user?.firstname} else {''}}\",
\"manager": "${if(managerAccount.accountID !=null) {managerAccount?.accountID} else {''}}\",'
else
'\"givenname\": \"${if(user.firstname !=null) {user?.firstname} else {''}}\",
\"sn\": \"${if(user.lastname !=null) {user?.lastname} else {''}}\",'
}}
SYNTAX 2)
{${if(user?.customproperty10.equalsIgnoreCase('noupdate'))
"givenname": "${if(user.firstname !=null) {user?.firstname} else {''}}",
"manager": "${if(managerAccount.accountID !=null) {managerAccount?.accountID} else {''}}"}
else
{"givenname": "${if(user.firstname !=null) {user?.firstname} else {''}}",
"sn": "${if(user.lastname !=null) {user?.lastname} else {''}}",
"title": "${if(user.title !=null) {user?.title} else {''}}",
}}
Getting a similar error for both: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported)
Does someone have input on this?
Thanks in advance!
02/28/2023 09:16 AM
You can try something like below
"extensionAttribute8": "${if(user?.customproperty38.equals('xyz')){user.employeeid} else {'SEC_'+user.employeeid}}"
03/02/2023 08:46 PM
i tried this approach, but i have another doubt. if i 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 customproperty, what should be the syntax for that.
So far, I've tried these:
"l":"${if(user.customproperty10.isEmpty()) ${user?.city}}",
"l": "${if(user.customproperty10.equalsIgnoreCase('')) ${user?.city}}"
"l": "${if(user.customproperty10.equals('')) ${user?.city}}"
"l":"${if(user.customproperty10 ==null)${user?.city}}"
"l":"${if((user.customproperty10 === null ? '' : user.customproperty10) === user.city)(SAVIYNTNOTCHANGED) else {user?.city}}"
"department":"${if(user.customproperty10 !=null) else ${user?.departmentname}}"
"l": "${if(user?.customproperty10 != 'noupdate'))${user.city}}",
All of these are giving me error. Is there any other syntax i can use?
Thanks in advance!
02/28/2023 11:00 PM
sample :
{${if((user?.username.startsWith('XX') || user?.username.startsWith('XY') && user?.email.contains('XX'))
'\"userprincipalname\" : \"'+user.email.toString().toLowerCase()+'\",
\"extensionattribute1\" : \"A'+user.customproperty3+'\",
\"cn\":\"'+user.lastname+'\\, '+user.firstname+'('+ user.customproperty3+')'+'\",'
else
'\"userprincipalname\" : \"'+user.email.toString().toLowerCase().substring(0,user.email.indexOf('@'))+'@<specify company name>.com\",
\"extensionattribute1\" : \"A'+user.customproperty3+'\",
\"cn\":\"'+user.lastname+'\\, '+user.firstname+'('+ user.customproperty3+')'+'\",'}}
03/03/2023 09:31 AM
Can you try with the below syntax
"l": "${if(user?.customproperty10 != 'noupdate')${user?.city}}"