Unable to set accountExpires in AD

RahulMulik
New Contributor II
New Contributor II

Hi Team,

We have a use case where on user termination we want to set the user's AD account's accountExpires to currentdate + 90 days.
Currently, in DISABLEACCOUNTJSON we have the following.
"accountExpires": "${{Long.toString(10000*(Calendar.getInstance().getTime() + 7776000000 + 11644473600000))}}"

But this is throwing the error as shown below:
{"log":"groovy.lang.MissingMethodException: No signature of method: java.util.Date.plus() is applicable for argument types: (java.lang.Long) values: [7776000000]\n","stream":"stdout","time":"2022-11-08T05:30:58.133544137Z"}

Please help us what will resolve this issue.

Thanks,
Rahul Mulik

8 REPLIES 8

avinashchhetri
Saviynt Employee
Saviynt Employee

@RahulMulik,

Are you setting the termination date from HR in any of the user attribute ?

If Yes,then you could so something a simple as:

"accountExpires": "${(10000*(user.enddate.getTime() + 7776000000+ 11644473600000))}"

 

 

Regards,
Avinash Chhetri

Hi @avinashchhetri ,

What if we want to set current date + 90 days?
Is it not possible?

Thanks,
Rahul Mulik

RahulMulik
New Contributor II
New Contributor II

Hi Experts,

Can we add 90 days to the current date and pass?

Thanks,
Rahul Mulik

 

"accountExpires": "${(10000*(Calendar.getInstance().getTime() + 7776000000+ 11644473600000))}"


Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

Hi Rushikesh,
I tried the below JSON in Disable Account and it gives me the below error in logs.

JSON:
{
"userAccountControl": "514",
"extensionAttribute1": "",
"accountExpires": "${(10000*(Calendar.getInstance().getTime() + 7776000000+ 11644473600000))}",
"password": "TestPassword"
}

Error:

{"log":"2022-12-21 07:34:12,977 [quartzScheduler_Worker-10] ERROR ldap.SaviyntGroovyLdapService - Exception \n","stream":"stdout","time":"2022-12-21T07:34:12.984938784Z"}
2022-12-21, 01:04 pm
ecm-worker
{"log":"groovy.lang.MissingMethodException: No signature of method: java.util.Date.plus() is applicable for argument types: (java.lang.Long) values: [7776000000]\n","stream":"stdout","time":"2022-12-21T07:34:12.984961634Z"}
2022-12-21, 01:04 pm
ecm-worker
{"log":"Possible solutions: plus(int), wait(long), parse(java.lang.String), minus(int), split(groovy.lang.Closure), use([Ljava.lang.Object;)\n","stream":"stdout","time":"2022-12-21T07:34:12.984965032Z"}
 
Thanks,
Rahul Mulik

try new date()


Regards,
Rushikesh Vartak
If the response is helpful, please click Accept As Solution and kudos it.

aundreb
Regular Contributor
Regular Contributor

Was this ever resolved? I tried the same thing but just went to set current date without + 90 days by using "${(Calendar.getInstance().getTime() + 11644473600000) * 10000 }" and tried using new date as well, but I get the same error as you with both. What is the correct solution to set current date on accountExpires attribute?

ssrnitish
New Contributor III
New Contributor III

As a work around, instead of using Calendar object, Can you try using task object's startdate or updatedate

${(task.updatedate().getTime() + 11644473600000) * 10000 }

 

Thanks,

Nitish