01-25-2023 09:02 AM
hi Team , We are copying this in email template subject line it give below error popup.
Operation not allowed as you are entering a value that resembles or contains script code
whats wrong with below ?
<% if(null!=user?.customproperty51 || user?.customproperty51!='') print "${java.text.SimpleDateFormat('dd MMM yyyy').format( java.text.SimpleDateFormat('yyyy-MM-dd').parse(java.time.LocalDate.now().plusDays(Integer.valueOf(user.customproperty51)).toString()))}" %>
Solved! Go to Solution.
01-25-2023 09:08 AM
parse format keyword are blocked
01-25-2023 09:12 AM
Okay, any other way to format the date in subject ?
01-25-2023 09:45 AM - edited 01-25-2023 09:47 AM
Try below
<% if(null!=user?.customproperty51 || user?.customproperty51!='') print "${java.text.SimpleDateFormat('dd MMM yyyy').format(new Date().plus(Integer.valueOf(user.customproperty51)))}" %>
or
<% if(null!=user?.customproperty51 || user?.customproperty51!='') print "${java.text.SimpleDateFormat('dd MMM yyyy').format(Date().plus(Integer.valueOf(user.customproperty51)))}" %>
01-26-2023 07:41 AM
tried getting this error
println.PrintlnToLogger - Println :: \u001b[1;31m| Error \u001b[22;39mgroovy.lang.MissingPropertyException: No such property: java for class: SimpleTemplateScript416\u001b[m\n","stream":"stdout","time":"2023-01-26T15:37:52.218005562Z"}
01-26-2023 07:46 AM
this worked with new keyword
<% if(null!=user?.customproperty51 || user?.customproperty51!='') print "${new java.text.SimpleDateFormat('dd MMM yyyy').format(new Date().plus(Integer.valueOf(user.customproperty51)))}" %>
01-26-2023 07:51 AM
Great can you mark the helpful answers and close the thread if issue is resolved
01-26-2023 08:12 AM - edited 01-26-2023 08:13 AM
I am getting "Operation not allowed as you are entering a value that resembles or contains script code" while saving for below in the subject
<% if(user?.customproperty51=='5') print "Disabled" else print "Deleted" %>
01-26-2023 08:20 AM
Can you try with below statement with advanced html checked?
<% if (user?.customproperty51=='5') print "Disabled" else print "Deleted" %>
I did try on my side and didn't see any issue in saving email template
01-26-2023 11:10 AM
This worked below , it seems length of the subject not taking more than 255 chars.
Action Required - Your Equifax account will be ${user?.customproperty51=='5'?"Disabled":"Deleted"} on ${new java.text.SimpleDateFormat('dd MMM yyyy').format(new Date().plus(Integer.valueOf(user.customproperty51)))}
01-26-2023 08:27 AM - edited 01-26-2023 08:28 AM
can you try saving below
DEV - Action Required - Your Equifax account will be <% if(!user?.customproperty51 && user?.customproperty51=='5') print "Disabled" else print "Deleted" %> on <% if(null!=user?.customproperty51 || user?.customproperty51!='') print "${new java.text.SimpleDateFormat('dd MMM yyyy').format(new Date().plus(Integer.valueOf(user.customproperty51)))}" %>
01-26-2023 11:13 AM
Above statement is failing because it crossed the limit of subject column(varchar(255)). Try to trim your statement as below so that it can work
DEV:Action Required - Your Equifax account will be ${user?.customproperty51=='5'?"Disabled":"Deleted"} on ${(!user?.customproperty51)?(new java.text.SimpleDateFormat('dd MMM yyyy').format(new Date().plus(user.customproperty51.toInteger())))}