Help

Randomly Assign a value from a aSingle Select on Record creation

Topic Labels: Automations
1563 2
cancel
Showing results for 
Search instead for 
Did you mean: 
JPPSO_NC
6 - Interface Innovator
6 - Interface Innovator

I have a field that is called Assigned to and it is a single select. It has for example 4 values. When a record is added, I want it to randomly select one of the 4 options and update the record.

2 Replies 2

The Batch Update app lets you randomly assign a value, but it can’t be automated in any way. You would have to manually run it every time you want to assign value(s):

To automate random value selection, you would need to write a custom JavaScript to do that.

Welcome to the Airtable community!

If records are not created in bulk at the same time, you can do this without scripting.

Get a random value between 0-59 by looking at the seconds of the created time of the record. Convert this random number to a random choice using nested if functions.

IF(
    SECOND( CREATED_TIME() ) < 15,
    "Choice 1",
IF(
    SECOND( CREATED_TIME() ) < 30,
    "Choice 2",
IF(
    SECOND( CREATED_TIME() ) < 45,
    "Choice 3",
    "Choice 4"
)))

Or you could use a formula field that uses MOD and SWITCH for the same result.

SWITCH(
    MOD(
        SECOND( CREATED_TIME() ), 
        4
    ),
    0, "Choice 1",
    1, "Choice 2",
    2, "Choice 3",
    3, "Choice 4"
)

If the value does not need to be edited later, you are done. If the value needs to be editable, add an automation that copies the formula result to an editable field.