Unable to send array with multiple objects from Javascript to bubble element

I want to send an array from toolbox_javascript using bubble_fn to a bubble repeating group element but get below error

Array I want to send from Run_Javascript to repeating group

[
    {
      "name": "Independent Method Claim",
      "code": "graph TD; A[Detecting Movement] --> B[Generating a digital content based on movement]; B --> C[Digital content represents text and/or drawings];"
    },
    {
      "name": "Dependent Method Claim",
      "code": "graph TD; A[Generating a speech description of content];"
    }
  ]

Error that I received in console

run_debug.js:725 Element JavascripttoBubble A - The plugin Toolbox / element Javascript to Bubble threw the following error: Error: Expected a string, but got a object (original data: {"name":"Independent Method Claim","code":"graph TD; A[Detecting Movement] --> B[Generating a digital content based on movement]; B --> C[Digital content represents text and/or drawings];"})
    at generate_JS_to_bubble_error (https://patent-my-idea-4.bubbleapps.io/package/run_debug_js/25e47a0c4ecc1910e6b19485b33cbb574831925a786a5d0c20a36a39966814d6/xfalse/x25/run_debug.js:607:22675)
    at Object.JS_to_bubble (https://patent-my-idea-4.bubbleapps.io/package/run_debug_js/25e47a0c4ecc1910e6b19485b33cbb574831925a786a5d0c20a36a39966814d6/xfalse/x25/run_debug.js:608:3068) (please report this to the plugin author)

Can someone help with this issue?

As you read in your error its expecting and String but getting an object, try to look the type you set in the FN element on page level what is it.

@Baloshi69


I have set it as β€˜text’

To give a full picture of what I am trying to achieve is, I am making an API call which gives me below response and I want to fetch and pass the β€˜flowcharts’ array value into repeating group from javascript

{
  "claims": "1. A pen comprising: a sensor configured ...",
  "flowcharts": [
    {
      "name": "independent_method_claims",
      "code": "graph TD; A[Start] --> B[Detecting pen movement]; B --> C[Generating digital content based on detected movement]; C --> D[Generating speech description of digital content]; D --> E[End]"
    },
    {
      "name": "dependent_method_claims",
      "code": "graph TD; A[Start] --> B[Storing the digital content]; B --> C[Wirelessly communicating the digital content to remote device]; C --> D[Converting detected movement into digital format]; D --> E[Adjusting speech description based on user settings]; E --> F[End]"
    }
  ]
} 

Javascript code
image

Have you been able to solve it?

No, I am unable to find any solution.

However, I have discovered a workaround for my specific problem. My app is on a paid plan, which enables me to utilize Bubble APIs.

So, now I am calling the Bubble API in RunJavascript and sending the array value to the backend workflow, where the API detects data. From there, I am saving the value in a database, which I then display in my frontend.

1 Like

I was finally able to solve it as well. I modified my object in javascript to single dimensional array - values are delimited by special symbols. Then I sent this list to bubble using bubble_fn_list function. Now I can show the list in a repeating group and extract the values using regex in each column.
I was able to find this solution thanks to this comment How to use Javascript in bubble - #6 by exception-rambler

1 Like