Forums

Fetch database last inserted record id to display

portalpuebla 09 Feb, 2021
Back in CFv6 we inserted in database all the form answers. At the end, we use to append the id of the inserted record for users reference like this:

In custom html message or email:
{var:save_data1.aid}

save_data1 was the alias for the save data action and represented the dataset in CFv6

But now in CFv7 database storage is a Behaviour and we no longer get an alias to reference the dataset, and no combination of things seem to work.

How can it be done in this new version?

Best regards.
Max_admin 14 Feb, 2021
Answer
if you use the "Save Data" action to save then you can do the same, ignore the global behavior if you want to do that!

Also you may enable the form debug and check the variable of the global behavior and get the path to the last id from there!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
portalpuebla 15 Feb, 2021
If I dump the array $this->data with PHP I can see the fields values, but the debug shows another array below which holds the aid (last record inserted) .

What's the name of that array?

Debug won't show the array's name:

You need to login to be able to post a reply.