Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

SMS Sending is not working in To field of Email Template

plana77
New Contributor III
New Contributor III

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:

Screenshot 2022-08-16 at 9.59.30.png

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

6 REPLIES 6

sahajranajee
Saviynt Employee
Saviynt Employee

Hi @plana77 ,

Please use 'Calendar.getInstance().getTime()' instead of 'new Date()' for your code block.


Regards,
Sahaj Ranajee
Sr. Product Specialist

plana77
New Contributor III
New Contributor III

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

sahajranajee
Saviynt Employee
Saviynt Employee

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.


Regards,
Sahaj Ranajee
Sr. Product Specialist

plana77
New Contributor III
New Contributor III

Hi!

by using print $(user.startdate}

I got print 2022-06-19 00:00:00.0

Best Regards,Päivi

plana77
New Contributor III
New Contributor III

if i use ${Calendar.getInstance().getTime()}

i get  Tue Aug 16 12:59:33 UTC 2022

sahajranajee
Saviynt Employee
Saviynt Employee

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.


Regards,
Sahaj Ranajee
Sr. Product Specialist