Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/16/2022 12:38 AM
Hi!
I am trying to send SMS by using Email template which is attached into AD Endpoint and is sent when New Account Task is completed, but nothing is sent to my phone when i am testing this?
I have validated code and it looks ok to me?
${(new Date().clearTime() >= user.startdate) ? (user.phonenumber != null ? (user?.phonenumber.replaceFirst('\\+','')+'@smtp.gatewayapi.com') : (manager?.phonenumber.replaceFirst('\\+','')+'@smtp.gatewayapi.com')) :''}
Here is template:
I can not find clear error from logfile either saying that this email template has issue when AD Provisioning job is run.
If i have these in email template, i will get SMS:
${manager?.phonenumber.replaceFirst('\\+','')+'@smtp.gatewayapi.com'}
${user?.phonenumber.replaceFirst('\\+','')+'@smtp.gatewayapi.com'}
Best Regards,Päivi Lana
Solved! Go to Solution.
08/16/2022 01:24 AM
Hi @plana77 ,
Please use 'Calendar.getInstance().getTime()' instead of 'new Date()' for your code block.
08/16/2022 03:03 AM
Hi!
Thanks of this,
I tested code like this, but i still do not get SMS message to my phone?
${(Calendar.getInstance().getTime().clearTime() >= user.startdate) ? (user.phonenumber != null ? (user?.phonenumber.replaceFirst('\\+','')+'@smtp.gatewayapi.com') : (manager?.phonenumber.replaceFirst('\\+','')+'@smtp.gatewayapi.com'))}
Best Regards,Päivi
08/16/2022 03:19 AM
Hi @plana77 ,
clearTime() is not a method available with Calendar.getInstance() . From your original post it looks like you wish to compare from start date. When you look at the logs, can you see the issue. If new keyword is an issue, that is when you can look at Calendar.getInstance() but if that is not the issue then it will be an issue with the date format between new Date and MySQL datetime field stored for start date.
Could you please check that first? You can try printing user.startdate on your email template to see if that gets sent out.
08/16/2022 05:31 AM
Hi!
by using print $(user.startdate}
I got print 2022-06-19 00:00:00.0
Best Regards,Päivi
08/16/2022 06:03 AM
if i use ${Calendar.getInstance().getTime()}
i get Tue Aug 16 12:59:33 UTC 2022
08/16/2022 06:45 AM
Hello @plana77 ,
Try something like below. Works on my IDE :
(Calendar.getInstance().getTime().format('yyyy-MM-dd') > Date.parse('yyyy-MM-dd',user.startdate).format('yyyy-MM-dd'))
Then check logs if some characters like quotes would need escaping in case they are erroring out.