Failed rule "s.match is not a function"

Hi, I am trying to set the value of a select field to the option “Internal” with

await fibery.updateEntity(entity.type, entity.id, {
        'Last Update' : { 'Id': '...id...', 'Name': 'Internal' }
    });

and I am getting the error

Failed to execute Action "Script": s.match is not a function

setting the Name fields just works… what can it be?
thank you very much

Giuse

To be clear, you’re trying to update the value of a single-select field (called ‘Last update’) to be ‘Internal’, which is an existing option for that field, is that right?

If so, then you just need to do this:

    await fibery.updateEntity(entity.type, entity.id, {
        'Last update': 'Internal'
    });

HI @Chr1sG. Thanks, but is there a way to not have to hard-code the label of the option into the script action, so that the script does not break as option names are improved, corrected, normalised or changed for whatever reason. I have tried various ways to use the UUID of the option, but I cannot figure out the correct object notation, even though I have tried pretty much all combinations with the UUID and even Public ID.

Is the workaround to use addCollectionItem with the enum DB’s entities field somehow?

await fibery.updateEntity(entity.type, entity.id, {
    'Last update': '136194f0-29f3-11f1-8681-0f3eec7ed495'
});

where 136194f0-29f3-11f1-8681-0f3eec7ed495 is the UUID of the option should work fine (for updating a single-select field called ‘Last update’).

Are you trying to update a multi-select?

1 Like

Thank you so much! Yes, also multi-select. But this single select one helps a lot, as I kept trying to pass it as an object, not realising that the whole s.match is probably because you are checking to see if the string is a UUID or not.

multi-selects are treated like to-many relations (collection fields) so should use the addCollectionItem syntax