After Save code no new record
Posted: Fri Dec 07, 2018 12:28 pm
Hi
I have some code in "After Save" to send an email when a record is updated that uses data from fields in the current record.
This code works fine when updating an existing record but fails to get data from the fields on a new record, I can see the problem is that #record_id# is not populated at this point when its a new record as when I debug it has a value of -1
Is there another reference I should use to get the record id of the new record or another way to get it to work on a new record?
The relivant part of my code is:->>>
$select2 = "SELECT * FROM works WHERE works_id='#record_id#'";
$run2 = nuRunQuery($select2);
$r = db_fetch_array($run2);
$subject = "IT Help desk: " .$r['wrk_status'] . " - " . $r['wrk_name'];
$wrknotes = $r['wrk_notes'];
$wrkuserid = $r['wrk_users_id'];
nuDebug($wrkuserid);
<<<
Thank you Brian ...
I have some code in "After Save" to send an email when a record is updated that uses data from fields in the current record.
This code works fine when updating an existing record but fails to get data from the fields on a new record, I can see the problem is that #record_id# is not populated at this point when its a new record as when I debug it has a value of -1
Is there another reference I should use to get the record id of the new record or another way to get it to work on a new record?
The relivant part of my code is:->>>
$select2 = "SELECT * FROM works WHERE works_id='#record_id#'";
$run2 = nuRunQuery($select2);
$r = db_fetch_array($run2);
$subject = "IT Help desk: " .$r['wrk_status'] . " - " . $r['wrk_name'];
$wrknotes = $r['wrk_notes'];
$wrkuserid = $r['wrk_users_id'];
nuDebug($wrkuserid);
<<<
Thank you Brian ...