Trouble Retrieving Return Values from Javascript to Bubble Plugin in Bubble.io

Hello,

I’m currently developing on Bubble.io and am trying to utilize the Javascript to Bubble plugin to pass the return values from a JavaScript function to Bubble’s workflows. However, I seem to be encountering an issue where the return value isn’t accessible within Bubble.

Here’s the JavaScript function I’m using:

function bubble_fn_image(str) {
    let result = '';
    let parts = str.split('[img width=');
    if (parts.length > 1) {
        result += parts[0];
        for (let i = 1; i < parts.length; i++) {
            let part = parts[i];
            let endIndex = part.indexOf('px]');
            if (endIndex !== -1) {
                result += '[img width=100%' + part.slice(endIndex + 3);
            } else {
                result += '[img width=' + part;
            }
        }
    } else {
        result = str;
    }
    return result;
}

let inputStr = "[img width=824px]//path_to_image1.png[/img][img width=824px]//path_to_image2.png[/img]";
let outputStr = bubble_fn_image(inputStr);
console.log(outputStr);



In the plugin settings, I’ve set the bubble_fn_suffix to image, expecting to reference the return value as Javascript to Bubble A's image. Despite these settings, the value isn’t showing up in other Bubble elements.

Could someone please help me understand what might be going wrong or how to correctly set up the plugin to receive the return values from JavaScript functions?

Any insights or guidance would be greatly appreciated.

Best regards, Taiyo