Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/05/2024 04:16 AM
Hello All,
We have a requirements within an AD connector update account JSON where Saviynt should only pass the title attribute on a user's start date (as the user can be onboarded before their start date as well).
We wanted to check if user's start date is greater than or equal to current date, then only pass the title attribute, otherwise pass empty string. Something like below:
"title":"${if(u.customproperty10 >= Date()) {user.title} else {''}}"
Do you have some sample working current date attributes / functions we can use within the connection? We might also need to have the same format for both the dates so that they can be compared.
Solved! Go to Solution.
06/05/2024 09:18 AM
@snauni try below
"title": "${new Date(u.customproperty10) >= new Date() ? user.title : ''}"
06/06/2024 12:51 AM
This did not work, we are getting the conversion error: Error Updating the Account from AD - Error in attribute conversion operation, data 0, v4f7c
06/05/2024 01:05 PM
"title": "${(new Date()).compareTo(new SimpleDateFormat('yyyy-MM-dd').parse(user.customproperty10)) >= 0 ? user.title : ''}"
06/06/2024 12:52 AM
This did not work, we are getting the error - Error Updating the Account from AD - Template contains string which are not allowed \bnew\s+[a-zA-Z0-9_.]{1,}\s*\(
06/09/2024 09:57 PM
"title": "${if (new Date().toISOString().split('T')[0] >= user.customproperty10) {user.title} else {''}}"
06/10/2024 12:02 AM
This did not work as expected. Saviynt is passing the entire condition as a string to AD. Title was passed as "${if (new Date().toISOString().split('T')[0] >= user.customproperty10) {user.title} else {''}}".
06/10/2024 07:46 PM
"title": "${groovy.lang.GroovyShell.evaluate('new Date().format("yyyy-MM-dd") >= user.customproperty10 ? user.title : ""')}",
06/11/2024 01:47 AM
This did not work. It looks like we cannot pass the variable groovy.
Thanks for the help. We were able to make it work using the below syntax:
"title":"${if(user.customproperty10 <= (Calendar.getInstance().getTime().format('yyyy-MM-dd'))) {user.title} else {''}}"