how to make a deadline reminder?<br>tableroject->field:deadline<br>many dates in deadline field. can i write coldfuion query to ask system to remind me two days before each deadline.<br>or use Scheduled Tasks.
You can set up a template, like:<br><br><FONT FACE=monospace><br><cfset date1=dateadd(2,"d",dateformat(now(),"mm/dd/yy")><br><cfset date2=dateadd(3,"d",dateformat(now(),"mm/dd/yy")><br><br><cfquery name="project" datasource="mytable"><br> select * from project<br> where deadline > '#date1#' and deadline < '#date2#'<br></cfquery><br><br><cfmail to="<A HREF="mailto:you@yourcompany.com">you@yourcompany.com</A>" from="you#yourcompany.com" subject="Deadline is coming"><br>The following projects are due on #dateformat(date1)#:<br><cfoutput query="project"><br>#ProjectName#</cfoutput><br></cfmail></font><br><br>and set it in the CF scheduled tasks to run daily....
what's "2" in "dateadd(2..."?<br>does it mean before two days?<br>when i tried to run this file. it shows some erro:<br>"A query driven CFOUTPUT tag is nested inside a CFMAIL tag that also has a QUERY= attribute. This is not allowed. Nesting these tags implies that you want to use grouped processing. However, only the top-level tag can specify the query that drives the processing."<br><br>
<FONT FACE=monospace><cfset date1=dateadd(2,"d",dateformat(now(),"mm/dd/yy")></font><br><br>Means "Add (2) "d"(days) to today at midnight (dateformat(now(),"mm/dd/yy" with no time specified).<br><br>Also, you must have specified a query in your cfmail tag. This would be what's causing your error....<br><br>If you are grouping around two columns in your query, say "ProjectOwner" (the email address) and "ProjectName" you should be able to get around this by doing something like:<br><br><FONT FACE=monospace><cfmail query="project" group="ProjectOwner" to="#ProjectOwner#" from="<A HREF="mailto:you@yourcompany.com">you@yourcompany.com</A>" subject="Deadline is coming"><br>The following projects are due on #dateformat(date1)#:<br><cfoutput group="ProjectName"><br>#ProjectName#</cfoutput><br></cfmail></font>
erro shows:<br>"Parameter 1 of function DateAdd which is now "2" must be a valid date/time part specifier<br>The error occurred while evaluating the expression: <br> date1=dateadd(2,"d",dateformat(now(),"mm/dd/yyyy")"<br><br>so i tried to add "", '', () to 2, still doesn't work.<br><br>
... let's read the doc ....<br><br>Syntax DateAdd(datepart, number, date)<br><br>that means the ocrrect syntax appears to b :<br> date1=dateadd("d",2,dateformat(now(),"mm/dd/yyyy")"<br><br><br><br>
if i use group, erro shows:"Loop error<br>The group ProjectOwner does not specify a column of the query"<br><br>if i delete group, and remove query="" from <cfoutput query="">to <cfmail query="" to="" from=""><br><br>it doesn't show any erro.<br>but i haven't got any email.<br>should i set mail server in coldfusion administrator?<br>
Whoops! I got the 2 and the "d" mixed up... Sorry about that...<br><br>Yes. You need to set up your mail server in the cf administrator. Either that, or specify your server in the mail tag... SERVER="mail.yourcompany.com" PORT="25" (the port number is almost always 25...) If you have access to the administrator, you should set it up there, though...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.