Question about record.id

I've been reading about the unique record ID associated with each record in the Knack database. But, I 'm new to Javascript, and it's not clear to me in the API examples how some fields are populated using record.id.

For example, in Knack's Attendance Manager app, the variable attendance_date = record.id.

Could someone shed some light on how attendance_date is populated with the correct date using record.id.

I thought the record.id was a unique identifier for a record row.

Thank you.

1 Like

Kayhan,

if you have any updates about this 4 years later, I would love to hear it. It doesnt actually seem like this is an easy ‘fix’. I’m also surprised more people dont need this feature. I assumed, like in Access or other relational databases, that your first column/field was your key variable/record ID; however, I was obviously incorrect.

Hi Austin,

When writing JavaScript in Knack, the record ID is discoverable inside Records events and Interface Events. For example:

// Change view_1 to your form
$(document).on('knack-record-create.view_1', function(event, view, record) {
  // Do something after the record is created via form submission
  alert('created a new record with record ID: ' + record.id);
});

When inside the Builder, the record ID is discoverable by inspecting the HTML table row ID, see: Finding Record IDs. It would be nicer if this record ID were a column in each record by default—hopefully Knack implements this feature in the future—but that’s currently not offered. Please upvote this related Feature Request: Add Record ID in the builder

Hope this helps. If you need professional assistance, feel free to reach out.

Ian
Knack Pros

1 Like