Objects in Standard Method Calls
Many SuiteScript 2.1 methods require one or more pieces of information in a single object. This object has one or more properties, which can be required or optional. You need to set a value for each required property, as well as any optional ones you use in your script.
When you set a value on a record, you use the Record.setValue(options) method. With this method, you need to provide two things: the ID of the field and the value you want to set. To do that, you create an object with a fieldId property and a value property, then pass that object to the method. For example:
var myObject = {
fieldId: 'Hello!',
value: 'Hello, World!'
};
myRecord.setValue(myObject);
Another way to pass an object is to define it right inside the method call. For example:
myRecord.setValue({
fieldId: 'Hello!',
value: 'Hello, World!'
});
In the documentation for standard SuiteScript 2.1 methods, each method argument is usually named options. In your script, however, you can name the object whatever you want. For an example, see SuiteScript 2.1 User Event Script Tutorial.
SuiteScript 2.1 does not support inline comments inside an object. Your script might not always throw an error, and it might not work correctly if you use them.