Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

creat comments when specific fields updated

Topic Labels: Automations
48 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Jason_Choi
4 - Data Explorer
4 - Data Explorer

I'm using automation.
I want to automatically add comments to the record when updating certain fields, but I can't..
What should I do

And. I keep failing to get records... I caught when record updated with trigger...

 

let table = base.getTable("Your Table Name");
let recordId = input.config().recordId; 

if (!recordId) {
throw new Error("Record ID가 정의되지 않았습니다.");
}

let record = await table.selectRecordAsync(recordId);

let fields = ["fields1, fields2, fields3"];
let changes = [];

for (let field of fields) {
let oldValue = record.getCellValue(field); // 
let newValue = record.getCellValue(field); /
if (oldValue !== newValue) {
changes.push(`${field} 값이 ${oldValue}에서 ${newValue}로 변경되었습니다.`);
}
}

if (changes.length > 0) {
output.set("changes", changes.join("\n"));
}

 

[Error]

ERROR
TypeError: Invalid arguments passed to table.selectRecordAsync(recordId, options):
• recordId should be a string, not undefined
at main on line 7

1 Reply 1

I believe you'll need to use the web API to create comments: https://airtable.com/developers/web/api/create-comment

This might be a tricky process if you're not already familiar with JavaScript, so I'd suggest asking someone you know who's familiar with JavaScript to help you with this