set(record)

This method of the record object sets field values in the current record in the main data set, or in a row in a detail table. (See also: record.)

record

The mandatory record parameter is a JavaScript object that contains one or more fields specified in the Data Model.
The record parameter may contain a subset of the fields in the Data Model. Only the fields included in the record parameter are updated in the database, while the contents of all other fields remain unchanged.
The call fails if the parameter is omitted or empty, if any of the fields specified in the record doesn't exist in the Data Model, or if a value cannot be converted to the data type that is expected in a field.

About data types

Where possible, values are automatically converted into the data type of the respective data field.

Dates must be passed as a Date object to allow them to be extracted into a Date field. See Date in the Mozilla help files.

Passing an improper data type triggers an error. For instance the following objects are all invalid:

{ myBoolean : "true" } - The myBoolean field is boolean and expects a boolean, not a string

{ myDate : "2021-03-29" } - The myDate field is a date and expects a Date object: myDate: new Date(2021,2,29), not a string

{ myPageCount : 2.5 } - The myPageCount field is an integer and expects a number without any decimals

{ myPrice : "19.99" } - The myPrice field is a currency and expects a number value, not a string

Example

record.set({customerName : "John Doe", customerAddress : "123 test road"});

The following example adds a row to a detail table and sets some values in it.

var row = record.tables.myDescriptions[i].addRow();
record.tables.myDescriptions[row].set({customerName : "John Doe", customerAddress : "123 test road"});