This topic is locked

Email with company name not the ID value

8/2/2011 12:17:50 PM
ASPRunnerPro General questions
S
smireb author

I have used the statard email event after record added as below.
Dim dkeys, tmpDict, msg, n

msg =""
dkeys = values.keys

For n = 0 To values.Count-1

if not IsBinaryType(GetFieldType(dkeys(n),"")) then

msg = msg & dkeys(n) & " : " & values(dkeys(n)) & vbcrlf

end if

Next
set tmpDict = CreateObject("Scripting.Dictionary")

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

tmpDict("subject")="New Record"

tmpDict("body")=msg

set ret=runner_mail(tmpDict)

if not ret("mailed") then

response.write ret("message")

end if
This is the output:
Status : Pending

ShipmentType : FCL

Customer : 1

PO/Reference# : PO123456

Carrier : APL

RequiredDate : 2011-08-26

BookingNumber : 7895623

Vessel : APL V.1

LoadPort : HKG

DischargePort : LAX

Destination :

ReadyDate :

LoadDate :

SI_CutOff :

PortCutOff :

ETSDate :

ETADate :

PackingList :

Commercialinvoice :

Documents :

BookingID : 8
The problem is that it outputs the customerID not the Company Name.
Can anyone help with this?

Sergey Kornilov admin 8/2/2011

This is the way how it supposed to work. If you need to retrieve CompanyName based on CustomerID you have to execute an additional SQL Query.
Example:

set rstmp=CustomQuery("select CompanyName from Companies where CustomerID=" & values("CustomerID"))


Now rstmp("CompanyName") contains the company name.