user-1
(User 1)
September 26, 2023, 12:03pm
1
This topic was automatically generated from Slack. You can find the original thread here .
Hello, I need to create a record to a table in airtable. The “create single record” action does not show the linked to other table fields.
Am I the only one?
Is it normal?
user-1
(User 1)
September 26, 2023, 12:03pm
2
from what I see, Pipedream uses Airtable API, so mostly it because that the Create Record API does not support what you want. You might need to combine it with other APIs
user-1
(User 1)
September 26, 2023, 12:03pm
3
I have created an issue #8121 . But this is a blocker for me because I need to link the newly created record to an other record
user-1
(User 1)
September 26, 2023, 12:03pm
4
Hi , I can reproduce your issue #8121 and I’ve added it to Pipedream backlog
I think for now you can ask @U05A7KLNALC to generate code step for you to create a record with linked field
user-1
(User 1)
September 26, 2023, 12:03pm
5
I understand that you need to create a record in Airtable with a linked field. While the “create single record” action might not support this directly, you can use a code step to achieve this. Here’s an example code step that creates a record with a linked field: ```
import { axios } from “@pipedream /platform”; export default defineComponent({ props: { apiKey: { type: “string”, label: “Airtable API Key”, secret: true, }, baseId: { type: “string”, label: “Base ID”, }, tableName: { type: “string”, label: “Table Name”, }, fieldName: { type: “string”, label: “Field Name”, }, fieldValue: { type: “string”, label: “Field Value”, }, linkedRecordId: { type: “string”, label: “Linked Record ID”, }, }, async run({ $ }) { const airtableApiUrl = https://api.airtable.com/v0/${this.baseId}/${encodeURIComponent(this.tableName)}
; const response = await axios($, { method: “POST”, url: airtableApiUrl, headers: { “Authorization”: Bearer ${this.apiKey}
, “Content-Type”: “application/json”, }, data: { fields: { [this.fieldName]: this.fieldValue, “Linked Field”: [this.linkedRecordId], }, }, }); return response; }, });