Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Email History Data for previous day

AravindK
Regular Contributor
Regular Contributor

Hi Team,
Email History table stores the data of emails which are stuck or the emails failed to send and the data of this emailhistory table stores in UTC ? and can someone provide sample query to fetch the data from the table which are failed in the last one day ?

Thanks,

6 REPLIES 6

armaanzahir
Valued Contributor
Valued Contributor

Hi @AravindK 

 

Try using the below query for failed tries of mail items that were generated in the last day

select * from emailhistory where retrycount>0 and STR_TO_DATE(createdate, '%d-%m-%Y %T') >= date_sub(CURdate(),interval 1 day)

 

armaanzahir_0-1707728806899.png

If you want to filter based on status as well, refer to the following status codes:

1 - SENDNOW

2- SENT

15 - INPROCESS

404 - ERROR WHILE SEND

 

 

Regards,
Md Armaan Zahir

AravindK
Regular Contributor
Regular Contributor

Hi @armaanzahir ,
Thanks for the response. Tried the above query but not able to execute it in data analyzer ,giving syntax error.

armaanzahir
Valued Contributor
Valued Contributor

@AravindK 

Please share the error screenshot. This works for me. Make sure there are no spaces before the select statement of the query.

armaanzahir_0-1707734787093.png

 

Regards,
Md Armaan Zahir

AravindK
Regular Contributor
Regular Contributor

Hi @armaanzahir ,
It is working . But Filters are not working as expected . I have mentioned interval for only one day but it is fetching all the records.

AravindK_1-1707744968547.png

 

 

AmitM
Valued Contributor
Valued Contributor

Hi @AravindK ,  try this 

select * from emailhistory where retrycount>0 and STR_TO_DATE(createdate, '%m-%d-%Y %T') >=  curdate()-1

Thanks,

Amit

AravindK
Regular Contributor
Regular Contributor

Hi @AmitM ,

No luck it is still fetching the records for old data and not for one day

AravindK_0-1707753861405.png