Javascript define variable of database thing

I’m trying to figure out the syntax for javascript in bubble.io’s “Run Javacript” workflow to define a variable from a bubble database data type.

I can define bubble elements and custom states as lists of texts as variables but can’t seem to define a javascript array to be a database list.

I have the following custom states:
custom_state_textlist (list of texts)
custom_state_contactslist (list of database contacts)

ex:
let array1 = ["custom_state_textlist join with “,” "]; //this is fine sincethis custom state is a text list
let array2 = ["custom_state_contactslist…??? i get the red error because this custom state points to a database Contacts. How can I do this?

My goal is to delete a selected item from a repeating group which displays a custom_state_contactslists (list of contacts). I want the user to click a trash can icon in the repeating group and I use javascript to delete the Contact item from the custom_state_contactslists. This is my workaround to using “minus item” because minus item deletes all duplicate values. I only want to delete the one selected Contact. (is minus item will delete all names “Joe” in the list whereas I only want to delete the single selected Joe.
[Ann, Joe, Bob, Joe]

Delete item 2…returns [Ann, Bob, Joe] not [Ann, Joe] if I used “minus item” instead of writing a javascript code.

But I can’t get past defining a javascript array of Contacts…not texts…

Please help! thanks!

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