Trigger a backend workflow when a checkbox is checked

Hi bubblers, I’m trying to trigger a backend workflow to run when a checkbox is checked. For example -

The subjects are set by the (user) teacher and then the teacher can assign a subject to be added to the Current Student. If the subject is in the students subject list in the DB then I’ve added a condition to check the corresponding subject checkbox. So that is all working as it should!

The problem I have is that I have a backend workflow that triggers an action to add the subjects to a student - (I followed this tutorial Recursive workflows for Beginners | but I can’t seem to add a key in the in the workflow that lets me know when a checkbox is checked. Does anyone know how I can achieve this? Do I have to give checkbox a state of :checked for example and then feed that in to my workflow?

You can trigger a workflow when a Checkbox's value is changed and this Checkbox is checked.

1 Like

Thanks for replying @williamtisdale - yeah and that’s exactly what I’m trying to do but I don’t have access to the Checkbox :checked state in my backend workflow. When I try to search for the Checkbox element in the search box nothing comes up.

Screenshot 2023-04-26 at 4.59.52 PM

So I’m trying to figure out how I relay that action to my backend workflow so when a checkbox is checked - I can then add the subject to that child.

I thought you just wanted to trigger the backend workflow at the time the box is checked and if that is the case then you know in your backend workflow that it is only running because the checkbox is checked. But if you need to know checked or not for each possible checkbox then a solution like below would work.

On your backend workflow just add a key/value pair that has a type of yes/no. Then when you call the backend workflow you can pass in Checkbox is checked from the front end. Then you will have either a yes or no on the backend.

@williamtisdale - yeah and that was exactly my approach. But as you can see - I don’t have access to the Checkbox at all. If I knew what had or hadn’t been checked then my problem would be solved. I fear I’m oversimplifying the task or going about it completely wrong.

Screenshot 2023-04-26 at 5.09.01 PM

Is it in a repeating group?

1 Like

Is your checkbox called “Checkbox…blahblah” or did you change the name?

1 Like

@williamtisdale - Yeah it’s in a repeating group

Hi again @melbournemarsden - it’s called “Checkbox Current Cell’s Subject”

Then you can only access it from actions that happen within the repeating group. You can create a custom state on an element outside of the repeating group and then make a workflow for when Checkbox Current cell’s subject value is changed then set the state to yes or no based on if the checkbox is checked or not and then you can access the custom
state where you need to.

1 Like

You can also replace your checkboxes with icons + text, and then run your action on “when [icon_name] is clicked”. Personally I don’t use Bubble’s built in checkboxes for anything. They have limited visual customization and you can’t use them for “when clicked” like with groups/buttons so it make stuff like this harder.

You can make a checkbox easily be creating an icon of an empty checkbox, then setting a condition on the icon to change it to a checked checkbox whenever the condition you want to change is met.

Then if it’s a simple yes/no, you can just do this:

Using “is no” will set it to whatever the opposite of its current state is, always.

If it’s not a “yes/no” or you need to do more complicated stuff, you need two workflows per checkbox. One that runs when it’s “no” and one that runs when it’s “yes” like this:


So in your case if I recall how the system works, you’d want one checkbox per subject named “Checkbox Science” or whatever.

Then [when “Checkbox Science” is clicked and “relevant user’s subjects doesn’t contain Science”] would be one workflow, and [when “Checkbox Science” is clicked and “relevant user’s subjects contains Science”] would be the other one.

1 Like

Same, default check boxes don’t look the greatest either

1 Like

@williamtisdale - yeah I thought that might have something to do with it. I’ll trying the state approach you outlined and report back. Thanks again!

@melbournemarsden - yeah that definitely seems like the prevailing approach out there, not use the checkbox at all and instead go with a custom group, text, icon, etc solution. That was my original approach which I ended up swapping out in favour of the native checkbox purely because I thought I would have accessed to what had been :checked. There’s approach above which @williamtisdale has pointed out but I think I’ll try your solution first. It makes sense to me the way you’ve described it and I’ll have a lot more design control on the frontend. Thanks again for your help and I’ll report back once I’ve :fingers-crossed: got everything working!

This topic was automatically closed after 70 days. New replies are no longer allowed.