Setting dropdown value via formula

I have created an automation where I would like to update a single-select field based on a conditional statement. However, I am stumped as to how to return the single-select option.

For example, I have a Project entity which is related to a Site entity. I am creating an automation whereby, if the Project Status is changed to “Closed”, then the Site Status field should change to “Backlog”, but only if it was already “In Progress”. Otherwise it should be left as is. Here is the pseudo-formula:

If([Step 1 Project].Site.Status.Name = "In Progress", {{set to "Backlog" status}}, [Step 1 Project].Site.Status)

Is this possible with formulas or do I need to use a script?

Currently only possible with a script, I’m afraid.

1 Like

Check the docs on the Select Field in automations.

Here is a script that does something similar –

// When someone changes the State of a Page Workflow entity,
// change the related "Current Task" entity's state => Open, 
// but only if the Task is currently blocked|dormant|done|hold

const TASK_TYPE = 'Projects/Task'
const TASK_STATE_OPEN = 'Open'
const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    const currentTask = entity['Current Task']
    if (!currentTask) continue
    // Get additional fields of related "Current Task" entity
    const task = await fibery.getEntityById(TASK_TYPE, currentTask.Id, ['State'])
    if (!task || !task.State.Name.match(/blocked|dormant|done|hold|waiting/i)) continue
    // Change "Current Task" state => Open
    await fibery.setState(TASK_TYPE, task.Id, TASK_STATE_OPEN)