Click HERE to see how Saviynt Intelligence is transforming the industry. |
02/11/2024 10:57 PM
Hi Team,
we have a requirement like validating the user form dates fields in between organization date fields.
Trying the below way.
1. Created a hidden attribute in user form which contains organization startdate from customer table. so, that we can compare user form startdate with organization startdate under validation condition ${(startdate <= orgstartdate )}.
But, while retriving the start date of organization date field from database attribute type is coming as string instead of Datetime. so, whenever trying to validate getting this below error.
"java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date"
Tried converting string to date format in mysql query as well as in validation condition, still same error.
2. Tried to place the query directly in validation condition like below
${((startdate) >= (select startdate as id from customer where customername = "ACN" ))}
but getting this below error
SimpleTemplateScript145.groovy: 1: expecting ')', found 'startdate' @ line 1, column 40.
out.print("""${((startdate) >= (select startdate as id from customer where customername = "ACN" ))}""");
Can anyone please suggest the way that, how can we get the functionality.
Thanks in Advance!
Solved! Go to Solution.
02/14/2024 12:27 AM
Hi @Padmavathi
Could you please share full screenshot of the attribute from register user form and also please confirm the attribute type mentioned in the attribute details.
Regards,
Dhruv Sharma
02/14/2024 06:31 AM - edited 02/14/2024 06:34 AM
Hi @Dhruv_S
Thanks for the response !
Please find the attached screenshot of user form. attribute type of startedate (user) is Date, the attribute type of orgstartdate (organization) is SQL ENUM
we have converted that SQL Enum output (from db it is coming as string type) into date in validation condition and validated. It is working.
We tried this way, please suggest us the other ways that we can use.
Thanks in advance!
02/19/2024 12:58 AM - edited 02/19/2024 12:59 AM
Hi @Padmavathi
Please check and confirm what is the format of date in the output of the below query. Please share screenshot of the output.
select startdate as id from customer where customername = "ACN"
Regards,
Dhruv Sharma
02/22/2024 12:09 AM
Hi @Padmavathi
Just checking if the issue got resolved? If not- could you, please provide the information requested above.
Regards,
Dhruv Sharma
02/22/2024 07:59 AM
Hi @Dhruv_S
Sorry for the delay!
The output of the query is coming in string format. then we converted that into date using date parse under validation condition. Now, the issue is resolved.
${(Date.parse("yyyy-MM-dd", orgenddate) >= enddate) && (enddate >=(startdate))}
Thanks!
02/22/2024 09:51 AM
Hi @Padmavathi - Please click the "Accept As Solution" button on the reply (or replies) that best answered your original question.
Thank you!