Help

Re: Conditional Update Single Select Field

2611 3
cancel
Showing results for 
Search instead for 
Did you mean: 

Based on template by @kuovonne ,

I want to use button to run the script. But I don’t want create two buttons.

My scenario is when Single Select field is “Not Started”, when I press the button, it will change to “In Progress”. When the field is “In Progress”, then I press the button again, it will change to “Completed”.

How do I achieve this?

Thanks.

6 Replies 6

You need a script that reads the current value of the script and then decides on the next value based on the current value.

Do you know how to write code? Are you interested in learning how to write code? If you are interested in learning to code, this would be a great beginner project.

Unfortunately, I’m a beginner coder. I’m learning it. So what I’m doing is ask two inputs in the beginning (achieved). After that I put if and else if statement just before “await” function to check what the value is.

However it doesn’t work. Am I doing in the right direction?

There are many ways to do things in code. It is hard to tell if you are in the right track or not from your post. You can try running you code to see what happens. If you get error messages, try to figure out what they mean. Use console.log to output variables to see their values. If you get stuck on something, post a screen shot of your code and the results of running it.

1st Step
image

2nd Step
image

However, it’s not working. It’s not showing any error though. Do I put if statement in the wrong place?

Your code is not producing any errors because it is grammatically correct code. However, it is not working properly because the logic for your code is wrong.

I recommend using console.log() or output.inspect() to show the values of variables so that you can better understand what is going on. For example, try console.log(settings.singleselectField.id) and you will see that it is not the value that you expect.

What resources do you have for learning to code?
If you have not coded before, you may need to back up a bit to learn some of the basics.
If you do not know how to do something specific to Airtable, the scripting documentation has instructions, although you may need to dig a bit to find the exact info you want.
If you want personal coaching, I offer appointments.

Thanks. I will try it this weekend.