Forums

Read table in database and go to end of record and email it

junfpurba 12 Jul, 2018
Hi, could you please help me, how to read table in database and go to end of record and email it ?

Regards.
healyhatman 12 Jul, 2018
Well it depends - how are they stored? Is there a created field? Or a sequential automatic id field? Because you could sort by that field in ascending order and return first matching.
junfpurba 12 Jul, 2018
They stored from registration form. I want to put increment number as invoice number to my customer.
healyhatman 12 Jul, 2018
OK so if I were you I would very much NOT simply read whatever the last record is and email it to the customer because inevitably you'll end up sending someone else's data.

What you want to do is use a save data action to save your record, and then use {var:save_data_name.model.id} which will give you the automatically generated ID of the record you just saved.
junfpurba 12 Jul, 2018
and how to put it to my email body?
junfpurba 12 Jul, 2018
Hi,
I've tried writing this in body email, but cf_id is not there.

<li>No. Invoice: {var:save_data8.Data8.cf_id}</li>

do you have solution ?
healyhatman 12 Jul, 2018
Is CF Id what your ilID field is actually called? Is it set to primary key Auto increment? Add a debug action and check there
junfpurba 13 Jul, 2018
Answer
Hi,
its SOLVED.
<li>No. Invoice: {var:save_data8.cf_id}</li>

Thanks healyhatman.
This topic is locked and no more replies can be posted.