Hi,
I have the following formula agent which has been running for ages and now it has decided to send Emails to all users regardless of the expiry date. It would appear that the @Return on the HSTDateDif is no longer working - any ideas?
REM {This agent is ran daily at 1am};
REM {This agent is used to send Emails to the named person and the DSRs};
REM {When an Employee Training Record is a month from expiry};
REM {The EmailSent field is set to Yes so that only one Reminder is Sent};
@If(EmailSent=“Yes”;@Return(“”);“”);
@If(HST_No_End_Date=“”;“”;@Return(“”));
@If(HST_Expiry_Date!=“”;“”;@Return(“”));
HSTdatedif:=@Integer((@Now - HST_Expiry_Date) / (60 * 60 * 24));
@If(HSTdatedif!=-30;@Return(“”);“”);
emailsubject:=(“Message from HASIT: Personal Training Record will expire in 30 days”);
EmailText1:=“Personal Training for “+HST_Name+” of type “+HST_Training_Type+” will expire in 30 days”;
EmailText2:=“Follow the link at the end of this message to go to the relevant record in the HASIT Database”;
Lookup:=@DbLookup(“”; “”;“EmailText”;“Training”;“EmailText”);
LookupEmailText:=@If(@IsError(Lookup);“”;Lookup);
@MailSend(EmailList;“”;“”;emailsubject;“”;EmailText1+@NewLine+@NewLine+LookupEmailText+@NewLine+@NewLine+EmailText2+@NewLine;[IncludeDoclink]);
FIELD EmailSent:=EmailSent;
@SetField(“EmailSent”;“Yes”);
SELECT @All
Thanks