Help

Cannot update field name from scripting automation

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

I'm trying to update a field name in a table using the script below, but getting this error: "Cannot update field name from scripting automation at main on line 22".  Has anyone else run into this problem?

 

 

let table = base.getTable("tblxxxxxx");
let field1 = table.getField("fldrxxxxx");

let today = new Date();
let quarter = Math.floor((today.getMonth() + 3) / 3); // Get the current quarter
let year = today.getFullYear();

// Calculate the prior quarter
let priorQuarter = quarter - 1;
let priorYear = year;
if (priorQuarter === 0) {
  priorQuarter = 4;
  priorYear--;
}

// Calculate the date for the prior quarter's last day
let priorQuarterLastDay = new Date(priorYear, priorQuarter * 3, 0);

let priorQuarterDate = priorQuarterLastDay.toLocaleDateString();
console.log(priorQuarterDate);

await field1.updateNameAsync(priorQuarterDate)
1 Reply 1

Automation scripts cannot create or update field names or configurations.