I want to send an email after a new record is inserted in a table. And merge that new record_id into the email template, which is in the repository.
The new record id is an auto increment field in an mysql table, so only available AFTER submit
Finding the new record-id and sending the email is no problem, I have as code:
In the email template i have a placeholder {ExecuteFunction:ondermel_nieuw_nummer}
ondermel_nieuw_nummer should be a xbasic function (in the xbasic function declaration or the dialog)
My problem is the syntax of that function, i have (but that doesn't work):
What should be the syntax (or where can i start reading the wiki / looking the video's)
Thanks in advance
The new record id is an auto increment field in an mysql table, so only available AFTER submit
Finding the new record-id and sending the email is no problem, I have as code:
function afterDialogValidate as v (e as p)
'To edit this action, place insertion point anywhere in the command, then click the 'Action Scripting' button'.
ExecuteServerSideAction("Save Data::Save")
session.NewMaintenanceRecordNumber = rtc.primaryTablePrimaryKey ' this stores the new record id in a session variable
if rtc.flagRecordWasSaved then
select
case e.dataSubmitted.ONDERMEL_STATUS = "NIEUW"
'To edit this action, place insertion point anywhere in the command, then click the 'Action Scripting' button'.
ExecuteServerSideAction("Send E-mail Message::Notification_status_nieuw")
end select
end if
'To edit this action, place insertion point anywhere in the command, then click the 'Action Scripting' button'.
ExecuteServerSideAction("Save Data::Save")
session.NewMaintenanceRecordNumber = rtc.primaryTablePrimaryKey ' this stores the new record id in a session variable
if rtc.flagRecordWasSaved then
select
case e.dataSubmitted.ONDERMEL_STATUS = "NIEUW"
'To edit this action, place insertion point anywhere in the command, then click the 'Action Scripting' button'.
ExecuteServerSideAction("Send E-mail Message::Notification_status_nieuw")
end select
end if
In the email template i have a placeholder {ExecuteFunction:ondermel_nieuw_nummer}
ondermel_nieuw_nummer should be a xbasic function (in the xbasic function declaration or the dialog)
My problem is the syntax of that function, i have (but that doesn't work):
function ondermel_nieuw_nummer as c (e as p)
ondermel_nieuw_nummer = session.NewMaintenanceRecordNumber
end function
ondermel_nieuw_nummer = session.NewMaintenanceRecordNumber
end function
Thanks in advance
Comment