How to return objects from plugins (SSA, CSA, Element Update & Element Workflow Actions)

You never return {“some”:”value”}

You probably want to

return {
“_p_score_titre”: levscore.distance

But you probably have an async action happening there and you’ll need more code than that if true

1 Like

Thank for your answer.
Actually, I try both way and the both return nothing.

But… just with this

function(properties, context) {
		var levenshtein = require("levenshtein")
		var srt1 = properties.reponsetitre
		var srt2 = properties.sessiontitre
		var levscore = new levenshtein(srt1,srt2)
		var score = levscore.distance
return {"score_titre": score};

I have the response.
I don’t understand why, but it’s working

The reason it works is because score_titre is the name of the return field that you defined in your returned values above. It appears that levscore.distance is simply a number. You don’t need to define the API type to return a simple type like a number.

Maybe your end goal/hope is to return more than just the distance value. But as your code is currently I think you have slightly overcomplicated the concept.


do a search for a plugin called “Return a bubble thing”

see it in action here

its a demo i made. be sure to check out the code. this is what you are shooting for.

1 Like

Thank you, it’s more clear now!

And yes, I have overcomplicated the concept!! But, reassure me, it’s newbies mistakes no ??

1 Like

Thank you so much for your work !!

1 Like

Excellent tutorials, @jared.gibb . I love the name of the test app poop123. I’m here for that.


Thanks for sharing this tutorial !!
I’m struggling to make it work I get an error when parsing the response.

Can anyone help me here? I must be missing something but I cannot find it

This is my setup:

I’m having issues with this myself today it seems… you’re not alone

Thanks, could this be after a Bubble upgrade?

I am wrong. I got mine to work. Both client-side and server-side able to return objects

Are you testing your plug-in or did you install your test plug-in? There’s a difference between the two if you installed your test plug-in, are you sure you’re running the latest version?

1 Like

Good morning, thanks for your reply.
No I have not installed it. I have not done any release, just using the test application

Might be worth switching out the return value for just the object stringified so that you’ve got eyes on exactly what’s being pushed back.

This does look really strange though…
I’m keen to get to the bottom of it has we heavily rely on this.

Also would be worth deleting the api call and setting it up again.

Oh I think I see it now… you’re not giving a return value key name. Try:

return {“api_data”: result}

1 Like

This is it exactly!!! @jasantana see the post above!!

You’re right!!! God I knew I was missing something but not that obvious!!
Thank you very much

1 Like

Yes, thanks. Saw it now. How could I miss that?!?!?!

1 Like

Coming soon!


Hey Jared, so looking forward to this one. I’m currently stuck on exactly this problem (returning object from plugin on client side)

welcome to my ramblings. thanks for reminding me about this one @flesik

Now, this example and video is only related to returning simple data however if you apply the concepts from the other examples for returning objects you can use it in the exact same manner

^^^returning simple data from an action, and triggering a workflow to handle the returned data

1 Like