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 ...
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
After Save code no new record
-
- Posts: 6
- Joined: Wed Mar 14, 2018 10:39 am
- Location: UK
- Contact:
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
Re: After Save code no new record
Use #RECORD_ID# (all upper case) instead of #record_id#.
If you want to know which Hash Cookies are available you could add this to the Before Browse event of the same Form.
And check it in the Debugger.Code: Select all
nuDebug(nuHash());