Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/16/2024 12:22 AM
Hi,
We have a requirement where AD password has to be generated for each account based on condition below:
first letter from First name + first letter from Last name + @ + #3 letters from joining month + Year
To generate password, each alphabet has 4 letter word set like:
a = Able
b = Bird and so on.
Eg. For user Alex Briks joining in August, password should be
We have no condition of unique password also not going to send it in email. Just need to set default password on the condition.
Please suggest a way to achieve this.
Solved! Go to Solution.
08/16/2024 12:33 AM
Hi @Kaustubh ,
${user.firstname}${user.lastname}${user.startdate.format('MM-yyyy')}
08/16/2024 07:21 AM
"${user.firstname.toUpperCase().substring(0,1)}${user.lastname.substring(0,1)}${user.startdate.format('MM-yyyy')}"
08/16/2024 10:34 AM - edited 08/16/2024 10:35 AM
Hi guys,
Let me clear the requirement.
Saviynt will fetch first letter from first name and first letter from last name.
Eg if username is Alex Briks then first letter of each name is A and B.
For A it should take Alfa, for B it should take Bravo and then append it with '@' +joining month + year.
In this case, password generated should be: AlfaBravo@Aug2024
For user Mary Jane, joining date April 2022, password should be MikeJuliett@Apr2022
User Rakesh Somani joining date December 2012, password should be RomeoSierra@Dec2012
a= Alfa, b= Bravo, c= Charlie, d=Delta, e=Echo, f=Foxtrot, g=Golf, h=Hotel, i=India, j=Juliett, k=Kilo, l=Lima, m=Mike, n=November, o=Oscar, p=Papa, q=Quebec, r=Romeo, s=Sierra, t=Tango, u=Uniform, v=Victor, w=Whiskey, x=X-ray, y=Yankee, z=Zulu
This password will be generated for all AD accounts.
08/16/2024 10:43 AM
Hi @Kaustubh , you need to apply multiple if else statement.
Fetch first letter if it is A use alex else B use Bravo same for lastname.
08/16/2024 10:44 AM
Use hidden dynamic attribute and generate password
08/19/2024 07:51 PM
I can use query like user.firstname.toString().toLowerCase().substring(0,1)
to fetch fist letter from first name of the user and likewise build the query.
Where do I put the code? Create Account JOSN of Active Directory?
Also please let me know how I achieve it using dynamic attribute.
08/19/2024 07:59 PM
SELECT CONCAT( CASE LOWER(SUBSTRING(FIRSTNAME, 1, 1)) WHEN 'a' THEN 'Alfa' WHEN 'b' THEN 'Bravo' WHEN 'c' THEN 'Charlie' WHEN 'd' THEN 'Delta' WHEN 'e' THEN 'Echo' WHEN 'f' THEN 'Foxtrot' WHEN 'g' THEN 'Golf' WHEN 'h' THEN 'Hotel' WHEN 'i' THEN 'India' WHEN 'j' THEN 'Juliett' WHEN 'k' THEN 'Kilo' WHEN 'l' THEN 'Lima' WHEN 'm' THEN 'Mike' WHEN 'n' THEN 'November' WHEN 'o' THEN 'Oscar' WHEN 'p' THEN 'Papa' WHEN 'q' THEN 'Quebec' WHEN 'r' THEN 'Romeo' WHEN 's' THEN 'Sierra' WHEN 't' THEN 'Tango' WHEN 'u' THEN 'Uniform' WHEN 'v' THEN 'Victor' WHEN 'w' THEN 'Whiskey' WHEN 'x' THEN 'X-ray' WHEN 'y' THEN 'Yankee' WHEN 'z' THEN 'Zulu' END, CASE LOWER(SUBSTRING(LASTNAME, 1, 1)) WHEN 'a' THEN 'Alfa' WHEN 'b' THEN 'Bravo' WHEN 'c' THEN 'Charlie' WHEN 'd' THEN 'Delta' WHEN 'e' THEN 'Echo' WHEN 'f' THEN 'Foxtrot' WHEN 'g' THEN 'Golf' WHEN 'h' THEN 'Hotel' WHEN 'i' THEN 'India' WHEN 'j' THEN 'Juliett' WHEN 'k' THEN 'Kilo' WHEN 'l' THEN 'Lima' WHEN 'm' THEN 'Mike' WHEN 'n' THEN 'November' WHEN 'o' THEN 'Oscar' WHEN 'p' THEN 'Papa' WHEN 'q' THEN 'Quebec' WHEN 'r' THEN 'Romeo' WHEN 's' THEN 'Sierra' WHEN 't' THEN 'Tango' WHEN 'u' THEN 'Uniform' WHEN 'v' THEN 'Victor' WHEN 'w' THEN 'Whiskey' WHEN 'x' THEN 'X-ray' WHEN 'y' THEN 'Yankee' WHEN 'z' THEN 'Zulu' END, '@', DATE_FORMAT(startdate, '%b'), DATE_FORMAT(startdate, '%Y') ) AS ID FROM USERS where userkey=${requestee}
Use Dynamic attribute in AD JSON ${PWD}
08/19/2024 08:00 PM
@Kaustubh hidden dynamic attribute value you won't be able to pass.. try to handle it in create account json only.
08/19/2024 09:50 PM
Hi Team,
The below code we are trying to generate password but we are getting the error.
"UnicodePwd":"${if(user.firstname.equals('Bhamini'){'alex'}else{'Andy'}'+if(user.lastname.equals('Sanga'){'Bravo'}else{'Ball'}+'@Aug2024}
Error while creating account in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript62619.groovy: 22: expecting ')', found 'else' @ line 22, column 66. name.equals('Bhamini'){'alex'}else{'Andy ^ 1 error
Could someone suggest how to do concat firstname and lastname according to logic.
Thanks,
Bhargavi Padaraju.
08/19/2024 10:06 PM
{
"UnicodePwd": "${(user.firstname.toLowerCase().charAt(0) == 'a' ? 'Alfa' : user.firstname.toLowerCase().charAt(0) == 'b' ? 'Bravo' : user.firstname.toLowerCase().charAt(0) == 'c' ? 'Charlie' : user.firstname.toLowerCase().charAt(0) == 'd' ? 'Delta' : user.firstname.toLowerCase().charAt(0) == 'e' ? 'Echo' : user.firstname.toLowerCase().charAt(0) == 'f' ? 'Foxtrot' : user.firstname.toLowerCase().charAt(0) == 'g' ? 'Golf' : user.firstname.toLowerCase().charAt(0) == 'h' ? 'Hotel' : user.firstname.toLowerCase().charAt(0) == 'i' ? 'India' : user.firstname.toLowerCase().charAt(0) == 'j' ? 'Juliett' : user.firstname.toLowerCase().charAt(0) == 'k' ? 'Kilo' : user.firstname.toLowerCase().charAt(0) == 'l' ? 'Lima' : user.firstname.toLowerCase().charAt(0) == 'm' ? 'Mike' : user.firstname.toLowerCase().charAt(0) == 'n' ? 'November' : user.firstname.toLowerCase().charAt(0) == 'o' ? 'Oscar' : user.firstname.toLowerCase().charAt(0) == 'p' ? 'Papa' : user.firstname.toLowerCase().charAt(0) == 'q' ? 'Quebec' : user.firstname.toLowerCase().charAt(0) == 'r' ? 'Romeo' : user.firstname.toLowerCase().charAt(0) == 's' ? 'Sierra' : user.firstname.toLowerCase().charAt(0) == 't' ? 'Tango' : user.firstname.toLowerCase().charAt(0) == 'u' ? 'Uniform' : user.firstname.toLowerCase().charAt(0) == 'v' ? 'Victor' : user.firstname.toLowerCase().charAt(0) == 'w' ? 'Whiskey' : user.firstname.toLowerCase().charAt(0) == 'x' ? 'X-ray' : user.firstname.toLowerCase().charAt(0) == 'y' ? 'Yankee' : user.firstname.toLowerCase().charAt(0) == 'z' ? 'Zulu' : '') + (user.lastname.toLowerCase().charAt(0) == 'a' ? 'Alfa' : user.lastname.toLowerCase().charAt(0) == 'b' ? 'Bravo' : user.lastname.toLowerCase().charAt(0) == 'c' ? 'Charlie' : user.lastname.toLowerCase().charAt(0) == 'd' ? 'Delta' : user.lastname.toLowerCase().charAt(0) == 'e' ? 'Echo' : user.lastname.toLowerCase().charAt(0) == 'f' ? 'Foxtrot' : user.lastname.toLowerCase().charAt(0) == 'g' ? 'Golf' : user.lastname.toLowerCase().charAt(0) == 'h' ? 'Hotel' : user.lastname.toLowerCase().charAt(0) == 'i' ? 'India' : user.lastname.toLowerCase().charAt(0) == 'j' ? 'Juliett' : user.lastname.toLowerCase().charAt(0) == 'k' ? 'Kilo' : user.lastname.toLowerCase().charAt(0) == 'l' ? 'Lima' : user.lastname.toLowerCase().charAt(0) == 'm' ? 'Mike' : user.lastname.toLowerCase().charAt(0) == 'n' ? 'November' : user.lastname.toLowerCase().charAt(0) == 'o' ? 'Oscar' : user.lastname.toLowerCase().charAt(0) == 'p' ? 'Papa' : user.lastname.toLowerCase().charAt(0) == 'q' ? 'Quebec' : user.lastname.toLowerCase().charAt(0) == 'r' ? 'Romeo' : user.lastname.toLowerCase().charAt(0) == 's' ? 'Sierra' : user.lastname.toLowerCase().charAt(0) == 't' ? 'Tango' : user.lastname.toLowerCase().charAt(0) == 'u' ? 'Uniform' : user.lastname.toLowerCase().charAt(0) == 'v' ? 'Victor' : user.lastname.toLowerCase().charAt(0) == 'w' ? 'Whiskey' : user.lastname.toLowerCase().charAt(0) == 'x' ? 'X-ray' : user.lastname.toLowerCase().charAt(0) == 'y' ? 'Yankee' : user.lastname.toLowerCase().charAt(0) == 'z' ? 'Zulu' : '') + '@Aug2024'}"
}
08/19/2024 10:00 PM
Try this
"UnicodePwd":"${if(user.firstname.equals('Bhamini')){'alex'}else{'Andy'}} ${if(user.lastname.equals('Sanga')){'Bravo'}else{'Ball'}}@Aug2024
08/19/2024 10:25 PM
Hi @NM ,
Tried, but did not work.
"UnicodePwd":"${if(user.firstname.equals('Bhamini')){'alex'}else{'Andy'}}${if(user.lastname.equals('Sanga')){'Bravo'}else{'Ball'}}@Aug2024"
Error logs:
Error while creating account in AD - [LDAP: error code 21 - 00000057: LdapErr: DSID-0C0911BC, comment: Error in attribute conversion operation, data 0, v3839]
Thanks,
Bhargavi Padaraju.
08/19/2024 11:30 PM
@Bhargavi3 , share error logs in txt format.
try once with this only- ${if(user.firstname.equals('Bhamini')){'alex'}else{'Andy'}}
08/19/2024 11:35 PM
Hi @NM ,
tried with this also, but did not work.
Got the below error:
Error while creating account in AD - [LDAP: error code 53 - 0000052D: SvcErr: DSID-031A126A, problem 5003 (WILL_NOT_PERFORM), data 0 ]
Thanks,
Bhargavi Padaraju.
08/19/2024 11:37 PM
Did you tried code i have shared
08/20/2024 12:08 AM
Complete logs in text file? @Bhargavi3
08/19/2024 11:49 PM
08/20/2024 12:23 AM - last edited on 08/20/2024 03:49 AM by Sunil
08/20/2024 06:49 AM - edited 08/20/2024 06:50 AM
"2024-08-20T07:21:01.496+00:00","ecm-worker","ldap.SaviyntGroovyLdapService","quartzScheduler_Worker-6-ldgr6","ERROR","Error while creating account in AD - [LDAP: error code 21 - 00000057: LdapErr: DSID-0C0911BC, comment: Error in attribute conversion operation, data 0, v3839 ]"
"2024-08-20T07:21:02.287+00:00","ecm-worker","","null-ldgr6","","javax.naming.directory.InvalidAttributeValueException: [LDAP: error code 21 - 00000057: LdapErr: DSID-0C0911BC, comment: Error in attribute conversion operation, data 0, v3839 ]; remaining name 'CN=Bhamini Sanga,OU=SaviyntTest,DC=XXXX,DC=COM' at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3274) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3207) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2998) at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(LdapCtx.java:840) at
Use part of logic don't use full and validate
"UnicodePwd": "${user.firstname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : ''}${user.lastname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : ''}@Aug2024"
08/20/2024 07:58 PM
Hi @rushikeshvartak ,
tried with the below code but did not work. please find the attached logs and suggest any way to acheive this.
"UnicodePwd": "${user.firstname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : ''}${user.lastname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : ''}@Aug2024"
Create Account Json:
{
"accountExpires":"0",
"co":"${user.country}",
"department":"${user.departmentname}",
"employeetype":"${user.employeeType}",
"givenName":"${user.firstname}",
"l":"${user.city}",
"mail":"${user.email}",
"name":"${user.firstname + '' + user.lastname}",
"objectClass":[
"top",
"person",
"organizationalPerson",
"user"
],
"pwdLastSet":"0", "SAMAccountName":"${user.email.substring(0,user.email.indexOf('@'))}",
"sn":"${user.lastname}",
"st":"${user.state}",
"manager": "${ if (managerAccount == null || managerAccount?.accountID == null || managerAccount?.accountID == '' ){''} else {managerAccount?.accountID} }", "streetAddress":"${user.street}",
"title":"${user.title}",
"userPrincipalName":"${user.email}",
"UnicodePwd": "${user.firstname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : ''}${user.lastname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : ''}@Aug2024"
}
Thanks,
Bhargavi Padaraju.
08/20/2024 09:04 PM
{
"accountExpires":"0",
"co":"${user.country}",
"department":"${user.departmentname}",
"employeetype":"${user.employeeType}",
"givenName":"${user.firstname}",
"l":"${user.city}",
"mail":"${user.email}",
"name":"${user.firstname} ${user.lastname}",
"objectClass":[
"top",
"person",
"organizationalPerson",
"user"
],
"pwdLastSet":"0",
"SAMAccountName":"${user.email.substring(0,user.email.indexOf('@'))}",
"sn":"${user.lastname}",
"st":"${user.state}",
"manager": "${ if (managerAccount == null || managerAccount?.accountID == null || managerAccount?.accountID == '' ){''} else {managerAccount?.accountID} }",
"streetAddress":"${user.street}",
"title":"${user.title}",
"userPrincipalName":"${user.email}",
"UnicodePwd": "\"${user.firstname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : ''}${user.lastname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : ''}@Aug2024\""
}
08/20/2024 09:16 PM
08/20/2024 09:17 PM
Check all values being used in your JSON:
08/23/2024 09:48 AM - edited 08/23/2024 09:48 AM
Thank you everyone for the response.
Working query:
"UnicodePwd": "${ (user.firstname.toLowerCase().substring(0, 1) == 'a' ? 'Alfa' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'c' ? 'Charlie' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'd' ? 'Delta' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'e' ? 'Echo' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'f' ? 'Foxtrot' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'g' ? 'Golf' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'h' ? 'Hotel' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'i' ? 'India' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'j' ? 'Juliett' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'k' ? 'Kilo' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'l' ? 'Lima' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'm' ? 'Mike' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'n' ? 'November' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'o' ? 'Oscar' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'p' ? 'Papa' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'q' ? 'Quebec' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'r' ? 'Romeo' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 's' ? 'Sierra' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 't' ? 'Tango' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'u' ? 'Uniform' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'v' ? 'Victor' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'w' ? 'Whiskey' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'x' ? 'X-ray' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'y' ? 'Yankee' : '') }${ (user.firstname.toLowerCase().substring(0, 1) == 'z' ? 'Zulu' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'a' ? 'Alfa' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'b' ? 'Bravo' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'c' ? 'Charlie' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'd' ? 'Delta' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'e' ? 'Echo' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'f' ? 'Foxtrot' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'g' ? 'Golf' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'h' ? 'Hotel' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'i' ? 'India' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'j' ? 'Juliett' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'k' ? 'Kilo' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'l' ? 'Lima' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'm' ? 'Mike' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'n' ? 'November' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'o' ? 'Oscar' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'p' ? 'Papa' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'q' ? 'Quebec' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'r' ? 'Romeo' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 's' ? 'Sierra' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 't' ? 'Tango' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'u' ? 'Uniform' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'v' ? 'Victor' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'w' ? 'Whiskey' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'x' ? 'X-ray' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'y' ? 'Yankee' : '') }${ (user.lastname.toLowerCase().substring(0, 1) == 'z' ? 'Zulu' : '') }@Aug2024"
09/05/2024 12:13 AM
Hi @rushikeshvartak @NM ,
We are able to generate a password by using the above logic in active directory, but when client is trying to login into AD, they are getting error.
Errror we are getting is : Your Email or password is incorrect.If you dont remember your password reset it now.
Could someone help us how we can resolve this issue?
Thanks,
Bhargavi
09/05/2024 12:17 AM
Hi @Bhargavi3 , hope you have applied the same logic in password email template Otherwise it won't work.
09/05/2024 12:45 AM
Actually No.
Our requirement is like with the above password which we specified in CreateAccjson IT team will login and perform some configurations. For enduser, we craeted one password policy and we are generating random password where end user will login into Active Directory.
Thanks,
Bhargavi Padaraju.
09/05/2024 12:47 AM
@Bhargavi3 , if you are setting the password in the basis of your logic but sending a random password they won't be able to login you have to send the same one.
09/05/2024 08:35 AM
What is variable used in email ?
09/05/2024 08:59 AM
There are two cases:
1. We are creating account, and password is generated from logic above.
eg. Rushi Vartak with startdate in September 2024, password will be RomeoVictor@Sep2024.
And we are not sharing this password over email.
However, for change password, we are using ${task?.password} in email
2. I tried to hard code the value in RESETANDCHANGEPASSWRDJSON as "UnicodePwd": "VictorDelta@Aug2024" but still the password was generated randomly, and was shared in email and end user can login with that random password.
09/05/2024 09:03 AM
This thread is going long please create new thread for this issue. In new thread please use below code and share output
Please validate supported variables.
Purpose :
To get what variables are present to use in the email template.
Email Template steps :
keep Advanced HTML CSS flag is checked
Keep your email Address in TO
TO /CC/BCC & Subject - Don't use any dynamic variables
Add only below code in Email Body
${this.binding.variables.each {RVkey,RVvalue -> println "$RVkey ------- $RVvalue" + "" + "br" + ">"}}
Output : using the below expression. By putting it in the email body, it will print all variable names with values, and then accordingly, you can use it:
09/05/2024 09:06 AM
Thread Closed - Solution Accepted!
This thread has been closed as the original issue has been successfully resolved.
To maintain a clean and organized forum, we ask that any new issues or questions be posted in a new thread. This helps keep discussions focused and makes it easier for others to search and find relevant solutions.
Thank you for your understanding and cooperation!