Agent code below for reference.Assume that docs exist that meet the criteria for the agent.
If the agent is set to run on schedule, no messages are sent.
If I leave the agent set to run on schedule and force it to run from designer (right click agent name - run), no messages are sent.
If I remove the [IncludeDocLinks] parameter and force the agent to run, mail is sent.
If I put the doc links back in but convert the agent to run on event, run on all agents in db, and force it to run from the client (Actions - test), mail is sent and the doc links are intact.
I have other scheduled agents on the same server with similar function code (and doc links) and they run without any problem.
I’m stumped. Any ideas?
TIA
Doug
REM {Send email on the day an item expires or on extension expiration date};
REM {Skip docs not created with the MSDS form. Skip items not expired. Skip hidden docs. Skip if chemical name is blank};
REM {NotifyWhenExpired is a multi-value field containing valid user names. I’ve replaced it with my name, no change in agent behavior};
@If(
Form != “frmMSDSExpiration” ; @Return(“”);
Hide = “Hidden”;@Return(“”);
ChemicalName = “”; @Return(“”);
@Success);
@If(
@Today < @Adjust(ExpirationDate; 0;0;-1;0;0;0); @Return(“”);
@Today = @Adjust(ExpirationDate; 0;0;-1;0;0;0) & ExtendDate = “”; @Success;
@Today = @Adjust(ExtendDate; 0;0;-1;0;0;0) ; @Success;
@Return(“”));
SendTo := NotifyWhenExpired;
cc := “”;
bcc := “Doug Finner”;
remark := “”;
Subject := “MSDS Material: " + ChemicalName + " will Expire Tomorrow”;
Body := "Material: " + ChemicalName + " Lot Code: " + LotBatchCode + " in Location: " + Location + " will Expire effective tomorrow. Please note that the attached link may not work if the item’s status has changed since this email was sent. ";
@MailSend( sendTo ; cc ; bcc ; subject ; remark ; body; [IncludeDoclink] );
SELECT @All
<<>>
For now, I’ve modified the agent in two ways; I’ve pulled the MailSend into the If statement (for some reason, leaving it outside the IF statement caused the system to send messages for everthing that expired; it’s as if it processed the 2nd and third conditions when the 2nd condition was true…).
I’ve switched to sending a Domino URL instead of a doc link.
Side note: we use Coex!Links to send NDLs since we use Exchange/Outlook for mail. It work fine for other scheduled agents so I don’t believe it’s the problem.
I’d still like to know why the doclink is killing the email message if anyone has ideas.
Here’s the revised code:
REM {Send email on the day an item expires or on extension expiration date};
REM {Skip docs not created with the MSDS form. Skip items not expired. Skip hidden docs. Skip if chemical name is blank};
@If(
Form != “frmMSDSExpiration” ; @Return(“”);
Hide = “Hidden”;@Return(“”);
ChemicalName = “”; @Return(“”);
@Success);
SendTo := NotifyWhenExpired;
cc := “”;
bcc := “Doug Finner”;
remark := “”;
Subject := “MSDS Material: " + ChemicalName + " will Expire Tomorrow”;
DbLink := “Notes://NotesKMC/” + @Subset(@DbName; -1) + “/vwExpiredMaterial”;
Body := "Material: " + ChemicalName + " Lot Code: " + LotBatchCode + " in Location: " + Location + " will Expire effective tomorrow. Please make sure Notes is running and you are logged in, then follow this link: " + DbLink;
@If(
@Today < @Adjust(ExpirationDate; 0;0;-1;0;0;0); @Return(“”);
@Today = @Adjust(ExpirationDate; 0;0;-1;0;0;0) & ExtendDate = “”; @MailSend( sendTo ; cc ; bcc ; subject ; remark ; body);
@Today = @Adjust(ExtendDate; 0;0;-1;0;0;0) ; @MailSend( sendTo ; cc ; bcc ; subject ; remark ; body);
@Return(“”));
SELECT @All