@if and @mailsend

I know it’s something simple I’m missing with this formula.

I have a field(difference) on a form with the following formula:

(@Today - RequestCompletionDate)/86400

Then I have a scheduled agent that looks at this field and sends an email if there is a match. The agent formula:

@If(difference = 48);

@MailSend(“Lotus Admin”; “”; “”; “TDP OVERDUE”; “The Recommendation/Task assigned to you from Incident Report " + Title + " is past due.” + @Char(13) + @Char(13) + @Char(13) + "Recommendation/Task: " + Rec + @Char(13) + @Char(13) + @Char(13) + "Today: " + @Text(@Today) + "Completion Date: " + @Text(RequestCompletionDate); “”; [IncludeDoclink]);

SELECT @All

It’s not recognizing the @if statement.

??

Thank you in advance.

Subject: thank you…

I moved the right parentheses from the beginning of the @if statement. I also removed the field from the form and now calculate the difference within the agent.

Appreciate the help.

Subject: @if and @mailsend

I’m not sure why it’s running at all. Unless you’ve mistyped the formula, you’re missing some parentheses here. It should be something along the lines of:

@If(difference = 48; @Mailsend(…); something else);

Or perhaps:

@If((difference = 48); @Mailsend…; something else);

Assuming the missing parenthesis is a typo, my guess is that your problem is in the document. If you’ve got a computed field on a form, it won’t update just because an agent looks at it. If you save the document today and the value is 48, it’ll stay 48 potentially forever if you don’t go into the document, refresh it, and save and close. Instead, you should probably compute the difference in your agent, thus:

current_difference := (@Today - RequestCompletionDate)/86400;

@If(current_difference = 48; @Mailsend…

…and so on.

Subject: @if and @mailsend

Change to

@If(difference=48;

@MailSend(“Lotus Admin”; “”; “”; “TDP OVERDUE”; “The Recommendation/Task assigned to you from Incident Report " + Title + " is past due.” + @Char(13) + @Char(13) + @Char(13) + "Recommendation/Task: " + Rec + @Char(13) + @Char(13) + @Char(13) + "Today: " + @Text(@Today) + "Completion Date: " + @Text(RequestCompletionDate); “”; [IncludeDoclink]);@Success);

SELECT @All