Help

Cannot update field name from scripting automation

Topic Labels: Automations
1425 3
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)
3 Replies 3

Automation scripts cannot create or update field names or configurations. 

Shouldn't that be mentioned in the API documentation even within 'Automations'? 

pdxbug_0-1692728214244.png

Is there any future roadmap to allow this? I'd request as a future update as it would be nice to make the field options flexible depending on what is happening on other tables and clean out any clutter that would just confuse the data.

MarioD
5 - Automation Enthusiast
5 - Automation Enthusiast

Can that be done via the then?