Help

Fairly attribute single select value

Topic Labels: Scripting extentions
Solved
Jump to Solution
637 1
cancel
Showing results for 
Search instead for 
Did you mean: 
DevMana
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi guys, first post for me and i’m french native so sorry for spelling mistakes

I have a base that shows every forms (one record for one form) and I would like to automaticaly fairly attribute a single select choice to each of these forms when they are submited
I have 3 developers and I would like to fairly attribute them a form (ex. I have 90 forms/I would like 30 forms per dev)

Here I’m attributing it manually
image

Thanks you guys

1 Solution

Accepted Solutions
DevMana
5 - Automation Enthusiast
5 - Automation Enthusiast

Used “number of records” modulo “number of people” and a simple switch case. I then get the output and update it with basic automation “Update Record” :

let queryResult = await view.selectRecordsAsync({fields: });
let nbRdvPris = queryResult.records.length;
let arrayBizDev = [“Christophe”, “Thomas”, “Hugo”]
let nbBizDev = arrayBizDev.length;
let bizDev;

switch (nbRdvPris % nbBizDev) {
case 0:
bizDev = “Christophe”;
break;
case 1:
bizDev = “Thomas”;
break;
case 2:
bizDev = “Hugo”;
break;
default:
console.log(erreur);
}

output.set(‘Business Developper’, bizDev);

See Solution in Thread

1 Reply 1
DevMana
5 - Automation Enthusiast
5 - Automation Enthusiast

Used “number of records” modulo “number of people” and a simple switch case. I then get the output and update it with basic automation “Update Record” :

let queryResult = await view.selectRecordsAsync({fields: });
let nbRdvPris = queryResult.records.length;
let arrayBizDev = [“Christophe”, “Thomas”, “Hugo”]
let nbBizDev = arrayBizDev.length;
let bizDev;

switch (nbRdvPris % nbBizDev) {
case 0:
bizDev = “Christophe”;
break;
case 1:
bizDev = “Thomas”;
break;
case 2:
bizDev = “Hugo”;
break;
default:
console.log(erreur);
}

output.set(‘Business Developper’, bizDev);