Page 1 of 1
nuAutoNumber value in AfterSave empty
Posted: Tue Oct 09, 2018 8:42 am
by marc
Code: Select all
nuAutoNumber
nuAutoNumber is a read-only nuBuilder Input field that will be populated once the Edit Form it is on, is saved for the first time.
It will be populated with an incrementing number.
It requires Next Number - The number this Autonumber will start from.
I need your help. I have created an object that contains an autoincrement value. How do I retrieve the value of an autoincrement field after saving a record? I would like to insert this value in the subject of an email that will be sent.
This always gives an empty value.
This did not help either.
https://forums.nubuilder.cloud/viewtopic. ... ash#p17912
Code: Select all
nuDebug(nuHash()['cust_autonumber']);
After saving, however, the value is in the field. It is also stored correctly in the database.
Re: nuAutoNumber value in AfterSave empty
Posted: Tue Oct 09, 2018 10:56 pm
by admin
marc,
You'll need to get it from the database on
After Save.
Code: Select all
$s = "SELECT cust_autonumber FROM customer WHERE customer_id = '#RECORD_ID#'"
Steven
Re: nuAutoNumber value in AfterSave empty
Posted: Fri Oct 12, 2018 7:07 am
by marc
Hi there, someone (can't remember the name) posted a useful function and the post is gone today

I had no time yesterday to copy it. Please restore the post if possible. Thank you!
Re: nuAutoNumber value in AfterSave empty
Posted: Fri Oct 12, 2018 8:05 am
by admin
marc,
Sorry I can't.
I'll finish what I hinted at before...
Code: Select all
$s = "SELECT cust_autonumber FROM customer WHERE customer_id = '#RECORD_ID#'";
$t = nuRunQuery($s);
$r = db_fetch_row($t);
$an = $r[0]; //-- autonumber
Steven
Re: nuAutoNumber value in AfterSave empty
Posted: Fri Oct 12, 2018 8:20 am
by marc
Thank you very much
Re: nuAutoNumber value in AfterSave empty
Posted: Fri Oct 12, 2018 10:58 pm
by admin
.