Skip to main content

Unable to retrieve data using field id

  • Jun 17, 2022 7:50 AM UTC
  • 8 replies
  • 198 views

Forum|alt.badge.img

Hello

The following code works when I pass in the field name as a string to the get function. It doesnt when I use the field id. I want to use field id. The code is taken from the API sample for javascript

	await table.select().eachPage(function page(records, fetchNextPage) {
		// This function (`page`) will get called for each page of records.

		records.forEach(function (record) {
			console.log('Retrieved', record.get('my-field-name') );
		});
		fetchNextPage();
	})

How can I do it using field id instead of ‘my-field-name’?

This topic has been closed for replies.

8 replies

Bill_French
Forum|alt.badge.img+19
  • Inspiring
  • Jun 18, 2022 2:04 AM UTC

Try…

record.id


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Jun 18, 2022 3:58 PM UTC

Try…

record.id


I think he wants to get field values by specifying the field ID instead of the field name. Getting the record ID won’t help in that case.


Forum|alt.badge.img
  • Author
  • New Participant
  • Jun 19, 2022 8:30 PM UTC

I think he wants to get field values by specifying the field ID instead of the field name. Getting the record ID won’t help in that case.


I indeed want to get the field values by specifying the field id, not the field name.


Forum|alt.badge.img+3
  • New Participant
  • Dec 7, 2022 11:28 AM UTC

Any news on this? As @David_Joyce mentioned I would like to get field values by id. I want to avoid field names in case those are updated so I'm using fieldIds to filter fields when selecting records but is not of much use if I cannot use the record.get() with the field Id.


Forum|alt.badge.img+5
  • Participating Frequently
  • Sep 21, 2023 6:23 AM UTC

Did anyone find a solution to this by any chance? 🙂
record.get(Field ID) returns undefined for me, but passing the field name return the field value just fine. ..However, this isn't really something I want to have to manage later when field names are inevitably changed 🤔 🤔


Forum|alt.badge.img+3
  • New Participant
  • Feb 22, 2024 4:55 PM UTC

Hello,
I'm facing the same issue, did you solve your issue?


Forum|alt.badge.img+5
  • Participating Frequently
  • Feb 25, 2024 11:30 PM UTC

Hello,
I'm facing the same issue, did you solve your issue?


Not me unfortunately, I ended up just going with field names. 


Forum|alt.badge.img+3
  • New Participant
  • Feb 26, 2024 8:05 AM UTC

using this:  select({ returnFieldsByFieldId: true }) solve my issue.
https://airtable.com/developers/web/api/get-record#query-returnfieldsbyfieldid