This topic is locked
[SOLVED]

 sending just the changed fields in an email

8/14/2009 3:30:16 PM
ASPRunnerPro General questions
A
apensler author

I know I have seen it before in the forum but I want to send a list of only the changed fields in an email after I have updated them. Can you direct me to the email that gives those instructions

C
clig 8/14/2009

I know I have seen it before in the forum but I want to send a list of only the changed fields in an email after I have updated them. Can you direct me to the email that gives those instructions


you could do a compare with session vars
example: edit on load you could assign vars on existing
strSQLExists = "SELECT TicketNo, SYSType, CustomerNo, ProjectNo, Customer, DateEntered, EnteredBy, NTSSSkillset, SIMSRegion, SIMSTicketNo, ITIL, Status, Priority, Description, SLADateTime, AssignedTo FROM NTSS_Tickets_Strip Where TicketNo = " & Request.QueryString("editid1")

set rsExists = CreateObject("ADODB.Recordset")

rsExists.Open strSQLExists, dbConnection

if not rsExists.eof then

Session("TicketNo") = rsExists("TicketNo")

Session("SYSType") = rsExists("SYSType")

Session("CustomerNumber") = rsExists("CustomerNo")

Session("ProjectNo") = rsExists("ProjectNo")

Session("Customer") = rsExists("Customer")

Session("DateEntered") = rsExists("DateEntered")

Session("EnteredBy") = rsExists("EnteredBy")

Session("NTSSSkillset") = rsExists("NTSSSkillset")

Session("SIMSRegion") = rsExists("SIMSRegion")

Session("SimsTicketNo") = rsExists("SIMSTicketNo")

Session("ITIL") = rsExists("ITIL")

Session("Status") = rsExists("Status")

Session("Priority") = rsExists("Priority")

Session("Description") = rsExists("Description")

Session("SLADateTime") = rsExists("SLADateTime")

Session("AssignedTo") = rsExists("AssignedTo")

Session("NTSSSkillset1") = rsExists("NTSSSkillset")

Session("NTSSTicketNo") = Request.QueryString("editid1")

else

end if

rsExists.Close : set rsExists = Nothing
Then in "After record updated"
' Get updated ticket vars - you could also use the dict("TicketNo") values - then it would be: if dict("NTSSSkillset") <> Session("NTSSSkillset") THEN without running the query below...
strSQLExists = "SELECT TicketNo, SYSType, CustomerNo, ProjectNo, Customer, DateEntered, EnteredBy, NTSSSkillset, SIMSRegion, SIMSTicketNo, ITIL, Status, Priority, Description, SLADateTime, AssignedTo FROM NTSS_Tickets_Strip Where TicketNo = " & Session("NTSSTicketNo")

set rsExists = CreateObject("ADODB.Recordset")

rsExists.Open strSQLExists, dbConnection

if not rsExists.eof then

Session("TicketNo") = rsExists("TicketNo")

Session("SYSType") = rsExists("SYSType")

Session("CustomerNumber") = rsExists("CustomerNo")

Session("CustomerNo") = rsExists("CustomerNo")

Session("ProjectNo") = rsExists("ProjectNo")

Session("Customer") = rsExists("Customer")

Session("DateEntered") = rsExists("DateEntered")

Session("EnteredBy") = rsExists("EnteredBy")

Session("NTSSSkillset") = rsExists("NTSSSkillset")

Session("SIMSRegion") = rsExists("SIMSRegion")

Session("SimsTicketNo") = rsExists("SIMSTicketNo")

Session("ITIL") = rsExists("ITIL")

Session("Status") = rsExists("Status")

Session("Priority") = rsExists("Priority")

Session("Description") = rsExists("Description")

Session("SLADateTime") = rsExists("SLADateTime")

Session("AssignedTo") = rsExists("AssignedTo")
else
end if

rsExists.Close : set rsExists = Nothing
do a compare on the vars - in this case I'm looking to see if a value is the same - do a <> for changes... - i.e.) if Session("NTSSSkillset1") <> Session("NTSSSkillset") THEN build email using Session("NTSSSkillset1") and so on...
If Session("NTSSSkillset1") = Session("NTSSSkillset") Then

email= SESSION("AssignedIDEmail") & ";" & SESSION("RefererIDEmail") & ";" & SESSION("UserIDEmail") & ";" & Session("EmailSub") & ";" & Session("EmailSub1") & ";" & Session("EmailSub2") & ";" & Session("EmailSub3") & ";NTSS@telus.com"

subject="NTSS - Ticket Updated For SIMS Call ID: " & Session("SimsTicketNo") & " / Customer: " & Session("Customer") & " / Project No: " & Session("ProjectNo") & " / NTSS Ticket No: " & Session("TicketNo")

message ="Description: " & Session("Description") & vbcrlf & "<hr size=1>" & "<a href=http://ntss.tsl.telus.com/NTSS/dbo_NTSS_Tickets_Ref_list.asp?a=search&value=1&SearchOption=Equals&SearchField=TicketNo&SearchFor="; & Session("TicketNo") & ">Queue</a>" & vbcrlf & "
" & "<a href=http://ntss.tsl.telus.com/NTSS/dbo_NTSS_Tickets_Me_list.asp?a=search&value=1&SearchOption=Equals&SearchField=TicketNo&SearchFor="; & Session("TicketNo") & ">Assignee Queue</a>" & vbcrlf & "<hr size=1>"
Else
...

J
Jane 8/17/2009

Hi,
use After record added event on the Events tab for this purpose. Old values are stored in the oldvalues array, new values are in the valuesarray.

A
apensler author 8/17/2009

Hi,

use After record added event on the Events tab for this purpose. Old values are stored in the oldvalues array, new values are in the valuesarray.


Jane,
Wasn't there a looping function that you already setup that allowed only those fields that were changed to be sent on an email? I thought I saw it a while ago but did not bookmark it. Maybe it was a suggestion from another user. I only want to send those items that changed in the after edit event. That way the email is not cluttered with all the fields in the record.