Hello!
I have a script to pick a collaborator from another thread. I’m telling the script which collaborators to choose from as not all would be assigned to a record. However, when I’m running the script, it’s consistently only assigning the first collaborator in the list.
Does anyone know how I can modify this script in my automation to basically round robin the collaborators? Where if it picked Collaborator1 this time, next time it picks Collaborator2? Or even, at a minimal request, get the script below to actually pick someone other than the first one all the time? :slightly_smiling_face:
I so appreciate this communities wealth of knowledge, so thank you in advance!
Trigger: When new record is created
Action: Run Script
const collaborators = [
{name: "Victoria Ward"},
{name: "Jordan Gill"}
]
const chosenOne = collaborators[Math.floor(Math.random() * collaborators.length)];
output.set("chosenOne", chosenOne.name)
Action: Update Record (the record that was just created) with collaborator chosen
