Global Custom State affecting multiple element

Hello!

Is it possible to create a global custom state that affects multiple elements?

Here is my use case: I want my customer to select one of 6 options (see screenshot). When an image is clicked, the border changes color and once I click next, the element that has been clicked the latest should be stored in my DB. Therefore I would like to create a global custom state that would have 6 options “t-shirt”, “polo”, “sweatshirt”, “hoodie”, “zip hoodie” or “other”. Am I having a good approach?

I tried and succeeded to implement the comportment I wanted by creating one custom state per image, but in the future I might add additional products and the amount of work to adapt and add new products grow exponentially and therefore I am looking for a better alternative.

Cyril

Hey @cyril,

One way to do that would be to have one custom state called user’s choice.
You would then have 6 workflows, for instance when tee-shirt is clicked > set user’s choice to “t-shirt”.

That’s a simple enough solution as you have 6 products. However if you want to scale that, let’s say you have 1000 products, you could still have one state, that changes dynamically with an item’s field.

For example, considering all your products have unique names (“t-shirt”, “polo”, “sweatshirt”, etc), and if all of your products are in one RG, you could then build a workflow such as:
When Cell is clicked > Set state user’s choice to *Current cell’s name".

Hope that helps
Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

Hi @ambroisedlg,

Thanks for your quick answer. How do you create a custom state that I can reach from each image? Indeed, every custom state that I created so far are only accessible for the specific element I created it from. For instance, for the T-shirt image, I created the custom state “user’s choice” but then, when I try to select if for the Sweatshirt image, I cannot access this custom state and need to re-create a new one (for information I can create a new custom state for the Sweatshirt image that has the same name as the state I used for the T-shirt image).

Cyril

@cyril, here is a quick example:

Demo: https://ambroisetestapps.bubbleapps.io/version-test/rg-states
Editor: https://bubble.io/page?type=page&name=rg-states&id=ambroisetestapps&tab=tabs-1

Hope this helps
Ambroise

Need extra help?

Book a free 15 minutes call - happy to help if I can

1 Like

Hi @ambroisedlg! Thanks a lot for your help, that was definitely very helpful and solved my problem! That being said I had to keep “group A” to store and access user’s choice for storing it in my DB. Indeed, when trying to “Make change to things” in Workflow I couldn’t access “Chantier Group”, I could only access “Repeated Group Chantier” which doesn’t contain users’ choice. Therefore I kept Group A in hidden which works but I believe is not the best way of doing it. Anyway the main functionality is reached! Thanks a lot! :smiley:

i was also facing the same. this post help me solve my problem about cyberpunk leather jackets. thanks for sharing.

@ambroisedlg can elements outside of a reusable element get the value of a custom state of the reusable element?