Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

AD connection updateaccountjson date calculation

tcorcoran
New Contributor III
New Contributor III

Hi,

So I have been having an issue figuring out how to do calculations within the connection json. I want to be able to look at the users start date and subtract 3 days and see if the current date is greater than or equal to that date.

Essentially we have new hires start on Mondays and we want to move them from our New Hire OU to our Employee OU so they get all their privileges the friday before they start. I already have the analytic and job set up to create the update task for these specific users but I just can't figure out the UPDATEACCOUNTJSON part. Any help would be appreciated.

Thanks

8 REPLIES 8

sahajranajee
Saviynt Employee
Saviynt Employee

Hi @tcorcoran 

Please look at the below forum thread if it gives you pointers on how to do it :
https://forums.saviynt.com/t5/identity-governance/sms-sending-is-not-working-in-to-field-of-email-te...


Regards,
Sahaj Ranajee
Sr. Product Specialist

tcorcoran
New Contributor III
New Contributor III

How do you subtract 3 days from the startdate

(Calendar.getInstance().getTime() >= user.startdate))

This is how I currently have it set up but this is not working.

Thank you

3 Days minus  --> new Date(Calendar.getInstance().getTimeInMillis()-(3*86400000))

rushikeshvartak_0-1662091111016.png

 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Our dev environment is currently on an update that does not allow objects such as "new Date" or "new String" I tried what you recommended but it didn't end up working. Here is the line I tried below:

"moveUsertoOU" : "${if (user.startdate != null && new Date(Calendar.getInstance().getTimeInMillis()+(3*86400000)) >= user.startdate) 'OU=Employees,DC=vfcu,DC=org'}"

I also tried:

 

"moveUsertoOU" : "${if (user.startdate != null && (Calendar.getInstance().getTimeInMillis()+(3*86400000)) >= user.startdate) 'OU=Employees,DC=vfcu,DC=org'}"
 
Both seemed to not work and I got errors.

Yes as part of new version new keyword is not allowed.

https://forums.saviynt.com/t5/identity-governance/sav-error-while-creating-account-template-contains... 

 

Try below

"moveUsertoOU" : "${if (user.startdate != null && (Calendar.getInstance().getTimeInMillis()-(3*86400000))) >= user.startdate.getTime()) 'OU=Employees,DC=vfcu,DC=org'}"


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

SethR
New Contributor II
New Contributor II

When I tried that it came back with this:

Error while Update operation for account-eevans in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript36.groovy: 5: unexpected token: >= @ line 5, column 114. TimeInMillis()+(3*86400000))) >= user.st ^ 1 error

 

I also tried converting the milliseconds into an actual number instead of doing the multiplication and that came back with the same error.

 

"moveUsertoOU": {"{${if(user?.startdate != null && (Calendar.getInstance().getTimeInMillis()-(3*86400000)) >= user.startdate.getTime()){\"OU=Employees,DC=vfcu,DC=org\"}}"


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Yup that ended up working thank you.