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!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, 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: 4565
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 529 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());