
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎May 18, 2021 09:58 AM
I’m working on a new personnel base and I’m having trouble wrapping my head around how to execute a link I’d like to see. Here’s the scenario:
I have 1 table of Staff. They are numbered based on the order I would like to hire them to work an event. So, if I need 5 people at an event, the staff numbered 1, 2, 3, 4, and 5 will be called in for the event. If I only need 2 people for the next event, it will still be staff #1 and 2.
I have another table of Events. Here I put in the number of staff I need, and I would really like to build a way for it to auto pull and link the appropriate staff members.
Any ideas?!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎May 18, 2021 12:05 PM
This would need an Automation that includes a script. You should try something like the following:
Automation Steps
- Type:
Run a script
Input Variables:key: count, value: the trigger record's {Necessary Staff Count} field
Script:
let {count} = input.config()
let table = base.getTable("Staff")
let query = await table.selectRecordsAsync({
sorts: [
{field: "Staffing Priority"},
]
})
let records = query.records.filter(record => Number(record.getCellValue("Staffing Priority")) <= count)
let recordIDs = records.length > 0 ? records.map(record => record.id) : []
output.set(recordIDs , recordIDs)
- Type:
Update record
Table:Events
Record ID:record ID from trigger
Fields:-
{Staff}
=output from the Run script action
-
