Help

How to add a single select field to my scripting app?

Topic Labels: Extensions
848 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Rachel_Ochoa
4 - Data Explorer
4 - Data Explorer

This community has been invaluable for me learning about all the cool things Airtable can do! My question was asked nearly identically on this post and I almost got my answer, but I’m having a bit of trouble on how to add a single select field to my template task creation. Everything works until line 20, where I tried to plug in ‘Category’–a single select field in my Tasks Template–in all manner of combinations , to no avail. Here is the script that works entirely well except for that one line. Can someone tell me what I’m doing wrong here? Perhaps @JonathanBowen since he’s the one that came up with this. :slightly_smiling_face:

let eventsT = base.getTable(‘Events’);
let tasksT = base.getTable(‘Tasks’);
let eventTemplateT = base.getTable(‘Event Templates’);
let tasksTemplateT = base.getTable(‘Task Templates’);
let tasksTemplateQ = await tasksTemplateT.selectRecordsAsync();

let event = await input.recordAsync(‘Pick an event’, eventsT);
let eventTemplate = await input.recordAsync(‘Pick an event template’, eventTemplateT);
let eventTasks = ;
if (eventTemplate) {
output.text(Creating tasks for ${event.getCellValueAsString('Event')} using template ${eventTemplate.getCellValueAsString('Name')} ... please wait);
for (let eventTask of eventTemplate.getCellValue(‘Tasks’)) {
let task = tasksTemplateQ.getRecord(eventTask.id);
eventTasks.push(
{
fields: {
‘Task’: task.name,
‘Notes’: task.getCellValue(‘Notes’),
‘Days before event’: task.getCellValue(‘Days before event’),
‘Category’: [ {id: category.id} ],
‘Event’: [ {id: event.id} ]
}
}
)
}
}
while (eventTasks.length > 0) {
await tasksT.createRecordsAsync(eventTasks.slice(0, 50));
eventTasks = eventTasks.slice(50);

 output.text('Tasks created!')

}

0 Replies 0