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

Need to pass customproperty stored Date value to AD LASTPASSWORDCHANGE::pwdLastSet in UpdateAccount

Sunny
New Contributor III
New Contributor III

Hi,

We are trying to pass the PasswordExpirationTime in AD while Create Account Json Such as:

CreateAccountJSon:

def calendar = Calendar.getInstance();
calendar.time = user.createdate;
calendar.add(Calendar.MONTH, 6);
def expireTime = new java.text.SimpleDateFormat('yyyyMMddHHmmss').format(calendar.timeInMillis) + 'Z'if(user.customproperty27 != null && user.customproperty27 != ''){jsonstring += '"PasswordExpirationTime": "'+expireTime+'",'}

 

Where it is working perfectly, However, When we are trying to send the date in UpdateAccount Json if the user Password is changed its throwing error. We have tried multiple approaches but still getting error.

UpdateAccountJSon:

def calendar = Calendar.getInstance(); calendar.time = user.customproperty27; calendar.add(Calendar.MONTH, 6); def expireTime = new java.text.SimpleDateFormat('yyyyMMddHHmmss').format(calendar.timeInMillis) + 'Z'if(user.customproperty27 != null && user.customproperty27 != ''){jsonstring += '"PasswordExpirationTime": "'+expireTime+'",'}

Values store in CP27 and CreateDate such as :

CREATEDATE CUSTOMPROPERTY27

Apr 08, 2024 08:38:532024-04-08 08:38:53

Data Store in AD end after createaccount :

PasswordExpirationTime:20241008083853Z

 

Any help would be appreciated.

6 REPLIES 6

NM
Valued Contributor
Valued Contributor

Hi @Sunny , just to be sure you are using update accountjson for password reset instead of resetpassword json of AD connector?

Sunny
New Contributor III
New Contributor III

HI @NM ,

I am talking about update accountjson for password reset attribute

Could you kindly provide a detailed snapshot of the information extracted from the logs, encompassing errors and other pertinent functionality details encountered during the execution of this process? Your assistance in furnishing this information would greatly aid in the analysis and resolution of any issues .


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

Sunny
New Contributor III
New Contributor III

Hi @rushikeshvartak ,

 

I believe the Issue is with the datatype.

Currently Using the below code :

def Calendar calendar = Calendar.getInstance();
calendar.setTime(user.customproperty27);
Date date = calendar.getTime();
calendar.setTime(date);
calendar.add(Calendar.MONTH, 6);
SimpleDateFormat dateFormat = java.text.SimpleDateFormat("MMM dd, yyyy HH:mm:ss");
def String expireTime = dateFormat.format(calendar.getTime()) + "Z";if(user.customproperty27 != null && user.customproperty27 != ''){jsonstring += '"PasswordExpirationTime": "'+expireTime+'",'}

 

However getting error in logs for the above code:

2024-05-14T10:52:55+05:30-ecm-worker--null-qk4p2--2024-05-14T05:22:55.092840541Z stdout F 2024-05-14 05:22:55,092 [quartzScheduler_Worker-8] ERROR ldap.SaviyntGroovyLdapService - Error Updating the Account from AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported😞 startup failed:

 

In Provisioning Comment Getting the below error:

Error while Update operation for account-MB00935 in AD - Error parsing JSON Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript26.groovy: 36: unexpected char: '\' @ line 36, column 53. ew java.text.SimpleDateFormat(\"MMM dd, ^ 1 error Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript31.groovy: 36: unexpected char: '\' @ line 36, column 53. ew java.text.SimpleDateFormat(\"MMM dd, ^ 1 error Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript27.groovy: 36: unexpected char: '\' @ line 36, column 53. ew java.text.SimpleDateFormat(\"MMMM dd, ^ 1 error Error while Update operation for account-MB00935 in AD - Template contains string which are not allowed \bnew\s+[a-zA-Z0-9_.]{1,}\s*\( Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript28.groovy: 36: unexpected char: '\' @ line 36, column 54. ew java.text.SimpleDateFormat(\"MMM dd, ^ 1 error Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript52.groovy: 35: unexpected char: '\' @ line 35, column 62. ew java.text.SimpleDateFormat(\"MMM dd,y ^ 1 error Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript65.groovy: 35: unexpected char: '\' @ line 35, column 62. ew java.text.SimpleDateFormat(\"yyyyMMdd ^ 1 error Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript66.groovy: 35: unexpected char: '\' @ line 35, column 62. ew java.text.SimpleDateFormat(\"yyyyMMdd ^ 1 error Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript53.groovy: 35: unexpected char: '\' @ line 35, column 62. ew java.text.SimpleDateFormat(\"MMM dd,y ^ 1 error Error while Update operation for account-MB00935 in AD - Template contains string which are not allowed \bnew\s+[a-zA-Z0-9_.]{1,}\s*\( Error while Update operation for account-MB00935 in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript55.groovy: 38: unexpected char: '\' @ line 38, column 66. = java.text.SimpleDateFormat(\"MMM dd, ^ 1 error
 

 

Sunny_0-1715664314955.png

 

Sunny
New Contributor III
New Contributor III

Hi @rushikeshvartak @NM ,

Any solution/appraoch could you please provide?

You can't use groovy script in json.

jsonstring += user.customproperty27 ? '"PasswordExpirationTime": "' + new java.text.SimpleDateFormat('yyyyMMddHHmmss').format(Calendar.getInstance().with { time = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss').parse(user.customproperty27); add(Calendar.MONTH, 6); time }) + '",' : ''


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