cancel
Showing results for 
Search instead for 
Did you mean: 

Alert query not working based on expiry date

Former Member
0 Kudos

Hi Experts,

I want to set up an alert for a UDF fields in my Sales Order Title based on the date which is put. The field is expiry date and I want that before 7 days of expiry date Alert should pop up. I am using the below query but No Alert is coming which is already set in Alert Management

I also want that 2 alerts should come which is before 7 days and before 15 days of expiry date.

declare @datevar datetime 
select @datevar = getdate()
SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T0.[U_LCVal], T0.[U_LCSDate], T0.[U_LCEdate] FROM ORDR T0 WHERE DATEDIFF(DD, T0.U_LCEdate, @datevar) > 7

Please guide what might be wrong.

Regards,

kamlesh

Accepted Solutions (1)

Accepted Solutions (1)

former_member187989
Active Contributor
0 Kudos

hi,

SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName], T0.[DocTotal], T0.[U_LCVal], T0.[U_LCSDate], T0.[U_LCEdate] FROM ORDR T0 WHERE DATEDIFF(DD, T0.U_LCEdate, getdate()) <= 7
OR DATEDIFF(DD, T0.U_LCEdate, getdate()) <= 15

Jeyakanthan

Answers (0)