Jun 14, 2023 09:09 PM
Hi all,
I'm very new to scripting and am struggling with the syntax to write to a multiple select field.
I have single select fields ("Monday AM", "Monday PM", "Tuesday AM", etc) that can be Y, N, or blank.
I have formula fields ("First Monday AM", "First Monday PM", "First Tuesday AM", etc) that calculate a date based on a user-entered date.
I have a multiple select field called "Availability". If "Monday AM" is Y, I want to pick up the date from "First Monday AM" and put it into "Availability."
Here is my code:
Jun 15, 2023 02:22 AM - edited Jun 15, 2023 02:22 AM
You'll need to use something like this:
const multipleSelectField = table.getField('My multiple select field');
await multipleSelectField.updateOptionsAsync({
choices: [
...multipleSelectField.options.choices,
{name: 'My new choice'},
],
});
I grabbed that from the documentation for multiple select fields and you can find that here
Jun 15, 2023 10:01 AM
Does this just update the options in the multiple select field? I want to update this particular record.
Jun 16, 2023 06:35 AM - edited Jun 16, 2023 06:36 AM
Yeah, you need to modify your code to use the structure above? e.g.
await table.updateRecordAsync(RECORD_ID,{
"Tags": [
...(record?.getCellValue('Tags')),
{"name": "C"}]
})
May I ask how much coding experience you have?