This topic is locked

email afteradd new record key field

7/8/2007 8:39:31 PM
ASPRunnerPro General questions
C
chris author

I have an oracle table that uses sequence to generate the next key index number("INCIDENT_NO"). How do I get that number and put it in an email to send to the person("UserID") and their supervisor("Supervisor_email") so they know the record #? is it possible? or do I need to use an oracle trigger to send out the email?

Thanks,

Chris.
I have the beforeadd setup to email the new data and that all works, just missing the record # that is created obviously it is not there yet until after that event takes place. Can you use and afteradd event to send email?
The users do not use this table to edit the record, they use different table view so that security and certain fields aren't visible to all users.

J
Jane 7/9/2007

Hi,
sure you can use AfterAdd event to send email to the user.

To select all entered information from the database in the AfterAdd event use this code:

str = "select FieldName1, FieldName2, FieldName3 from TableName where INCIDENT_NO=" & incident_no

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
'send email here

'rsTemp is the collection with all entered values
rsTemp.Close : set rsTemp = Nothing



where incident_no is the variable where ID of added record is stored.

C
chris author 7/9/2007

Hi,

sure you can use AfterAdd event to send email to the user.

To select all entered information from the database in the AfterAdd event use this code:
where incident_no is the variable where ID of added record is stored.


Here is the code I put into the event

[codebox]str = "select TYPE_INCIDENT, INCIDENT_DATE, INCIDENT_NO, ORIGINIATOR_EMAIL from CAPA.INCIDENT where INCIDENT_NO=" & incident_no
Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
sendmail

'rsTemp is the collection with all entered values
rsTemp.Close : set rsTemp = Nothing[/codebox]

I seem to be missing some pieces... I assume you need to put email address and you could have subject put in but how do I get the rest of the values in the message? Do I use another snipit of code to make the message?

Thanks for your help.

Chris.

J
Jane 7/9/2007

Chris,
you can find some samples in the ASPRunnerPro Help.

For example, to send email use Send simple email with old data record action.