Help

Re: Simple - Change a Value in an existing record

359 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Scott_Jenkins
4 - Data Explorer
4 - Data Explorer

I am not a skilled in Java script and am struggling with the simplest of a problem. Any help to get me going would be appriciated.

Example:

// Trying to change content of “Test Field” in an existing record to “Paused”
// through a button function in that record.

let table = base.getTable(‘ACC Base’);

//Test Field is a Single Select Field

let field = table.getField(‘Test Field’);
let value = “Paused”;

// When run from a button field, the script skips the prompt
// and automatically uses the button’s record.

let record = await input.recordAsync(‘Choose a record’, table);

await table.updateRecordAsync(record,
{‘Test Field’: “Paused”});

//End

1 Reply 1

What is the field type of the field? You need to use the correct write format for the field type.

For example, if it is a single select field, you would use …

await table.updateRecordAsync(record, 
  {'Test Field': {name: "Paused"}});