Please allow developers to add knack's Record ID as a read-only field in the builder. This would allow developers to quickly find records of interest to them when working through the API.
Please allow adding the Record ID as a field value in builder. It would be very helpful to have when sending multiple emails from a form to include direct links to connected records for the different users. Thank you.
Hi,
Thanks
Dan
Hi,
There is and I have already shared a way on here to add the ID in a field of the record for use wherever you like.
I will dig it out.
Thanks
Dan
Great idea to use the JSON export for this.
Maybe I'm missing something, but I don't see how in Step 6 you can "use your Record ID as the matching element". Since Knack doesn't expose the ID as a field, you can't specify it as the matching field. The only one available is the new "RID" field which is empty.
I can see this working as you describe if you first create an Auto Increment field in Knack, to assign each record a unique number, and then use that to match on import.
I should mention, I do the process above for bulk records that I've imported. For records that users are creating, I use the API to generate the RID field data:
//Sets the RID (field_78) to the Record ID
$(document).on('knack-record-create.view_32', function(event, view, record) {
var rid = record.id;
var data = {
field_78: rid
}
$.ajax( {
url: 'https://api.knackhq.com/v1/objects/object_2/records/'+rid,
type: 'PUT',
headers: {
'X-Knack-Application-Id': 'YOUR_APP_ID',
'X-Knack-REST-API-Key': 'YOUR_API_KEY'
},
data: data,
success: function(response) {
console.log('New location added!');
}
});
});
Anton, I agree this would be useful. As a workaround, I've started doing this:
- Export records into JSON
- Convert to CSV using https://konklone.io/json/
- In the Builder, create a new Short-Text Field called "RID" (or whatever you want)
- In your CSV, create a new RID column (I use Google Sheets for this), and copy your Record ID's into that column.
- Download as CSV from Google Sheets.
- Re-import the records into Knack (using your Record ID as the matching element, and add the "RID" column to your RID field in Knack.
It's a bit cumbersome, but if you really need the Record ID's in the builder, it works.
Crikey!! Well done, Iām only 7 years late to the party here reading this and only just discovered json exports ID, probably an error in the knack team as seems they like to keep you harnessed