Skip to main content

Creating new select options with an automation should colour them... but creates them all blue

  • March 6, 2024
  • 3 replies
  • 35 views

dancourse
Forum|alt.badge.img+4

Afternoon, all,

I have an automation which fills in a select field based on a linked field's id.

If the item doesn't exist in the select field already, it automatically creates a new item in the field.

However, every time the new item is created by the automation it's blue. Every new item is always blue.

Is this a bug? When we add them manually (which we don't want to do - hence why we automated it) they are colourised.

Here is the field,

Any clues, or help much appreciated. Thank you.

Best, DanC

 

3 replies

TheTimeSavingCo
Forum|alt.badge.img+31

I don't know that there's a way around that I'm afraid; hopefully someone else has an idea

As a workaround, you could use a script to help you update the select field and randomize the colors of all the options if you've got a ton of them?


dancourse
Forum|alt.badge.img+4
  • Author
  • New Participant
  • March 6, 2024

Thanks @TheTimeSavingCo - it appears an automation script can't update a field's config settings, "Error: Cannot update field config from scripting automation".

let table = base.getTable("Table 1"); const selectField = table.getField('The Select'); // attempt to make the item a colour await selectField.updateOptionsAsync({ choices: [ { "id": "sel123456789ABCD", "name": "Item 1", "color": "purpleBright" } ], });

I believe the only ways would be an API call or a manual script on the base.


dancourse
Forum|alt.badge.img+4
  • Author
  • New Participant
  • March 10, 2024

I don't know that there's a way around that I'm afraid; hopefully someone else has an idea

As a workaround, you could use a script to help you update the select field and randomize the colors of all the options if you've got a ton of them?


Thanks @TheTimeSavingCo - afraid a script is a manual trigger, so that won't work for us. 

Also it seems that using the script block with the internal API won't affect a colour change, and the errors says you can't change the config unless it's done with the external API.