This topic is locked

Event "Send Email with new data"

9/15/2009 7:04:21 PM
ASPRunnerPro General questions
P
Philip author

I'm using the standard code from "Send email with new data" within version 6.1 / 2503.
When I use the code in the "BEFOR record updated" Event, I get a mail with all the editable field values from EDIT page which seems to be correct.
When I use the code in the "AFTER record updated" Event, I get a mail with all the field values from the table - even from fields that are not on the EDIT page inlucing passwords!
Isn't that a bug? I prefer of course the "AFTER record updated" Event to get only mails of accepted = saved entries.
Philip

J
Jane 9/16/2009

Philip,
it's not bug.

$values array in the After record added event contains all field values. You can form email manually with fields you want to send:

msg = msg & "Field1" & " : " & values("Field1") & vbcrlf

msg = msg & "Field2" & " : " & values("Field2") & vbcrlf

msg = msg & "Field3" & " : " & values("Field3") & vbcrlf
P
Philip author 9/16/2009

Jane,
thanks for this clarification.
Philip

P
Philip author 9/16/2009



Philip,
it's not bug.

$values array in the After record added event contains all field values. You can form email manually with fields you want to send:

msg = msg & "Field1" & " : " & values("Field1") & vbcrlf

msg = msg & "Field2" & " : " & values("Field2") & vbcrlf

msg = msg & "Field3" & " : " & values("Field3") & vbcrlf



Jane,
this code returns the fieldnames as stated in database at not the set labels (I'm using even multilingual).

Can I replace "Field2" with an expression that gives back the label names?
Philip

J
Jane 9/16/2009

Philip,
here is a sample:

msg = msg & Label("Field1") & " : " & values("Field1") & vbcrlf
P
Philip author 9/16/2009



Philip,
here is a sample:

msg = msg & Label("Field1") & " : " & values("Field1") & vbcrlf



Jane,
I just tried this but doesn't work. I can access the EDIT page but when I try to save the changes I get an HTTP 500 error page.

Any idea?
Philip

Sergey Kornilov admin 9/16/2009

Turn off 'Show friendly HTTP error messages' option in Internet Explorer to see more detailed error message. Post it here.

P
Philip author 9/16/2009



Turn off 'Show friendly HTTP error messages' option in Internet Explorer to see more detailed error message. Post it here.


This is the error Message:
Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment: 'Label'

/_services/aoa3/mstelle_neu1/include/Meldestelle_Agility_events.asp, line 29
And this is my event code (before record updated):
Dim dkeys, tmpDict, msg, n

msg =""
msg = msg & label("M_Name") & " : " & values("M_Name") & vbcrlf
set tmpDict = CreateObject("Scripting.Dictionary")

tmpDict("to")="test@test.ch"

tmpDict("subject")="Sample subject"

tmpDict("body")=msg

set ret=runner_mail(tmpDict)

if not ret("mailed") then

response.write ret("message")

end if

BeforeEdit=true
Regards,

Philip

C
clig 9/16/2009



This is the error Message:
Microsoft VBScript runtime error '800a01c2'

Wrong number of arguments or invalid property assignment: 'Label'

/_services/aoa3/mstelle_neu1/include/Meldestelle_Agility_events.asp, line 29
And this is my event code (before record updated):
Dim dkeys, tmpDict, msg, n

msg =""
msg = msg & label("M_Name") & " : " & values("M_Name") & vbcrlf
set tmpDict = CreateObject("Scripting.Dictionary")

tmpDict("to")="test@test.ch"

tmpDict("subject")="Sample subject"

tmpDict("body")=msg

set ret=runner_mail(tmpDict)

if not ret("mailed") then

response.write ret("message")

end if

BeforeEdit=true
Regards,

Philip


wouldn't it be:
msg = msg & "M_Name" & " : " & values("M_Name") & vbcrlf

J
Jane 9/17/2009

Hi,
here is the correct code:

msg = msg & Label("Field1",strTableName) & " : " & values("Field1") & vbcrlf
P
Philip author 9/26/2009



Hi,
here is the correct code:

msg = msg & Label("Field1",strTableName) & " : " & values("Field1") & vbcrlf



Jane,

thanks for that - works fine.

Label("Field1",strTableName) shows the label in the default language; I'm working with a multilingual table.

QUESTION: is there a possibility to select language as well?
Regards

Philip

J
Jane 9/28/2009

Philip,
I'm not sure that I understand your question.

Where do you want to select language?

P
Philip author 9/28/2009



Philip,
I'm not sure that I understand your question.

Where do you want to select language?


Jane,

when a user has uptaded a record the application sends back to the user a confirmation mail.

This mail consists of:

Fieldname_1 : new content

Fieldname_2 : new content

...
With the actual statement msg = msg & Label("Field1",strTableName) & " : " & values("Field1") & vbcrlf

the fieldname is taken from the main language; I would like that the language of the fieldname corresponds with the chosen language in the list or while login.
Philip

J
Jane 9/29/2009

Philip,
use GetFieldLabel function for this purpose:

msg = msg & GetFieldLabel(strTableName,"Field1") & " : " & values("Field1") & vbcrlf
P
Philip author 9/29/2009



Philip,
use GetFieldLabel function for this purpose:

msg = msg & GetFieldLabel(strTableName,"Field1") & " : " & values("Field1") & vbcrlf



Jane,
many thanks - that works fine!
Philip