Alert won't work

Posted by kharaughty on 19-Apr-2012 14:13

We run Progress 9.1.d, I attempted to mash together an email alert based on a user-defined date field being met.

For guidance, I used some of the other alerts already created, along with some Progress documentation, unfortunately, I can't see the error of my way.

Please point me toward more documentation or tutorials that may help me become a successful, thanks.

-----------------------

{ud/GlbAlert.i &TableName = "Vendor"}

DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.

/* program for email when a Vendor's DD2345 certificate has expired, email to include Vendor Name */

IF Mfgsys.Vendor.Date01 = Current_Date

THEN DO:

FIND Mfgsys.Vendor WHERE

Mfgsys.Vendor.Date01 = Current_Date. NO-LOCK NO-ERROR

END.

/* Set the email address*/

ASSIGN Email-To = "k@espey.com"

/* Email-Subject = " Vendor DD2345 Expired, " + Vendor.Name */

/* Email-Text = " Vendor DD2345 Expired " + Vendor.Name */

/* Email-Text = "The subject Vendor's DD2345 Certification has Expired". */

END.

ELSE DO:

RETURN "CANCEL SEND":U.

END.

All Replies

Posted by robw@hltool.com on 19-Apr-2012 14:50

Don't you want to check for Date01

Plus your FIND is redundant and unecessary.

Should be

{ud/GlbAlert.i &TableName = "Vendor"}

DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.

/* program for email when a Vendor's DD2345 certificate has expired, email to include Vendor Name */

IF Mfgsys.Vendor.Date01

THEN DO:

/* Set the email address*/

ASSIGN

     Email-To = "k@espey.com"

     Email-Subject = " Vendor DD2345 Expired, " + Vendor.Name

     Email-Text = "The subject Vendor's DD2345 Certification has Expired".

END.

ELSE DO:

RETURN "CANCEL SEND":U.

END.

Posted by gus on 20-Apr-2012 10:34

But you may not want to send an email every day after the expiration, so recording the fact that an email has been sent may be helpful.

Posted by robw@hltool.com on 20-Apr-2012 10:52

agreed on that. We run checkers like this from linux cron jobs with email notify.  Since these are custom tables I always use a status field - Status = 'email sent' or Status = 1.

Conversely, when we interact with core ERP tables, instead of using fields within the canned database, we use custom tables to keep track of things like email sent.

I also "cheat" a bit with these types of programs and set a smallish date filter i.e. recorddate >= today - 7 or today - 3 to limit the number of records checked.  Depending on how often the cron job runs.

Hopefully the OP can get the alerts working,

Posted by kharaughty on 24-Apr-2012 06:22

Rob, thanks for answering my question so promptly.  Everything works, I prettied it up a little yesterday and I'm all set.  Thanks also to you and Gus for the short discussion on logging/recording the sending of the email which is something that I'll look into as well.  Cheers - Kevin

This thread is closed