I’ve seen several threads around this topic but honestly still have no clear idea of how to do this.
My plugin passes in a list of things with custom type which is defined by the user. I would like to publish that exact list to the elements custom state. What is the correct code / format to pass to Bubble? I thought it would be as simple as:
The custom state is typed to match the input list type.
Thanks for any help.
Can you share screenshot of your plugins settings?
You’ll have to first get the list and in each item get() the unique ID of these things, and then publish their unique ID. That’s what Bubble consider a “thing”. Let us know if that helped and share more details if not (:
Vini, you legend, thanks.
I should have guessed it was the reference to the object rather than trying to pass the whole object back
This is what I have on one of my plugins to process a list, there are other ways offcourse. @vini_brito What do you think of doing it this way?
Had no problem running this in the “update” function. However when I try to run it in the “initialiseState” function nothing gets returned / displayed front-end. Does this look correct?
@nocodeventure If it works, it works
Are you dealing with Bubble objects? I don’t see the get() function being used
@robhblake Glad it worked! Try console.log()'ing the “properties.list” to see what comes from it.
Also, try looking for any errors thrown in the console.
Thanks Vini. Not sure what was going on there, I just instantiated it in the update function instead.
Any idea why Bubble has a hard time accepting an array of objects as text - have you come across this type of behavior in your adventures?
The “array_sent” looks alright … right? The error gets thrown when I try to publishState (type: list of texts). This is the type of output I get:
Fixed now. I was trying to pass this into a list of texts custom state, whereas it should be single text.