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

Reset Password while enabling and disabling account only when user is rehired.

ssharma
New Contributor
New Contributor

We have a requirement where we want to reset user account password while enabling and disabling account  only when user is rehired or terminated. 

But whenever user is on leave or return from leave we only want to  enable or disable the account. No password reset should be done.

I am using the below JSON for enabling and Disabling account. It's not working as expected.

enable account JSON

{
"USEDNFROMACCOUNT": "YES",
"MOVEDN": "YES",
"ENABLEACCOUNTOU": "XXXX",
"REMOVEGROUPS": "NO",
"AFTERMOVEACTIONS": {"{${if(user?.customproperty4='Active'){\"userPassword\":\"randomPassword\"} else {\"useraccountcontrol\":\"512\"}}}",
"pwdLastSet": "0"}

}

 

Disable account JSON

{"deleteAllGroups":"No","moveUsertoOU":"XXXXX","userAccountControl":"514",
"AFTERMOVEACTIONS": {"{${if(user?.customproperty4='Terminated'){\"Password\":\"randomPassword\"} else {\"useraccountcontrol\":\"514\"}}}",
"pwdLastSet": "-1"}
}

I am getting the below error for the above JSON:

2022-08-16 16:41:04,458 [quartzScheduler_Worker-4] DEBUG println.PrintlnToLogger - Println :: | Error groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
SimpleTemplateScript13775.groovy: 2: unexpected char: '\' @ line 2, column 68.
customproperty4='Terminated'){\"Password

1 REPLY 1

rushikeshvartak
All-Star
All-Star

enable account JSON

{
"USEDNFROMACCOUNT": "YES",
"MOVEDN": "YES",
"ENABLEACCOUNTOU": "XXXX",
"REMOVEGROUPS": "NO",
"AFTERMOVEACTIONS": {"{${if(user?.customproperty4=='Active'){\"userPassword\":\"randomPassword\"} else {\"useraccountcontrol\":\"512\"}}}",
"pwdLastSet": "0"}

}

 

Disable account JSON

{"deleteAllGroups":"No","moveUsertoOU":"XXXXX","userAccountControl":"514",
"AFTERMOVEACTIONS": {"{${if(user?.customproperty4=='Terminated'){\"Password\":\"randomPassword\"} else {\"useraccountcontrol\":\"514\"}}}",
"pwdLastSet": "-1"}

 

Use == or equalsIgnoreCase
}


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