After Save code no new record

Questions related to customising nuBuilder Forte with Javascript or PHP.

After Save code no new record

Postby 191brian » Fri Dec 07, 2018 8:58 pm


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'];
Thank you Brian ...
Posts: 6
Joined: Wed Mar 14, 2018 7:09 pm
Location: UK

Re: After Save code no new record

Postby kev1n » Fri Dec 07, 2018 11:13 pm

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.

Code: Select all

And check it in the Debugger.
Posts: 13
Joined: Mon Oct 15, 2018 2:13 am

Return to Custom Code