List Popper and Friends: New SSA Plugin for Your Backend Workflow (API Workflow) Needs

This works now!! Thank you !! :slight_smile:

Hi @keith , first of all THANK YOU for sharing this. The video was especially helpful to help me understand how to get data out of a custom API call inside a server-side action (aka the API Ghetto you talk about).

But I’m having problems with this plugin because it doesn’t work with null or undefined values.

My API call returns a list of LinkedIn Pages. From that API call I extract the id, name, and logo for each page. I then use those values to build a list of ids, a list of names, and a list of logos which I return from the server-side action.

My aim is to take those lists and “pop” a list item of each one to turn it into a LinkedIn Page Bubble thing (aka turn it back into structured data inside Bubble). So far this is the same process as described in your video.

But (and this is the important part) some pages do not have a logo value. So to keep each list of equal length, which is crucial for making this process work, I have return a null or undefined value when there is no logo value.

And that is where things go wrong with List Popper…

When using undefined or null values the resulting LinkedIn Page data is all mixed up. The ids, names, and logos do not match each other.

I have tested this by using a text value of NOT FOUND instead of undefined or null and that does make the resulting LinkedIn Page have the correct ids, names, and logos. They are no longer mixed up.

But that workaround has it’s own drawbacks because Bubble no longer recognises the image as “empty” which causes various display problems on the front end.

Is there anyway we can make List Popper work with undefined/null or similar values? Is there another way of doing this using lists of unequal length?

So far the solution you describe here is the best I’ve found for the API Ghetto problem, but alas I’m stumbling at this last hurdle.

Also, I needed a way of Merging two lists without losing duplicates.

I took a look at your code for “List Pusher SSA” and used it to created a new “List Merger SSA”.

It works the same as “List Pusher SSA” but instead of adding one item it adds an entire list.

If you want to add it to the plugin for everyone to use then feel free :slight_smile:

Plugin Action Settings:

Plugin Action Code:

function(properties, context) {
    
    var currentList, mergedList, updatedList

    function getList(List) {
        var returnList = []
        if (!List.hasOwnProperty('get')) return returnList
        if (!List || List.length() < 1) return returnList
        returnList = List.get(0, List.length())
        return (returnList[0] && returnList[0].hasOwnProperty('listProperties')) ? returnList.map(item => item.get('_id')) : returnList
    } // end getList

    currentList = getList(properties.data_source)
    mergedList = getList(properties.list_to_merge)
    updatedList = currentList.concat(mergedList)
    return { updated_list: updatedList }
    // end merge
}

Congrats. You know what concatenation is. :+1:

2 Likes

Hi, I’m trying to use List Pusher SSA on a backend workflow to add numbers to a list of numbers on a thing but I get this error message in the server logs and the list doesn’t get updated

Workflow error - Plugin action List Pusher SSA error: TypeError: Cannot read property ‘hasOwnProperty’ of null at eval (eval at build_function (/var/task/index.js:72:21), :1:34) at eval (eval at build_function (/var/task/index.js:72:21), :1:198) at /var/task/index.js:335:23 at run_fn (/var/task/u.js:594:18)

Link to Editor:

Hi Keith, I can’t seem to get this to work. I’m pulling data from an external API.

But I keep getting this length error.

Any ideas?

There could be a bug in Flow State Single. (This error means we are checking .length on something that is undefined).

Can you show the setup on your Flow State Single step there?

Thanks!

Hey @bryan_333: Sorry I was on mobile before and didn’t see that you had included an image of your step for Flow State SSA.

Make sure you’re using the latest version (which you can select in your plugins tab). I’m looking at the (very very simple) code right now, and Flow State Single does not actually check the “length” property of anything so you shouldn’t be able to get this error at all.

Now, there is a slight bug here in that Flow State Single does not check that the “Item” field is actually populated and it could throw an error if there is in fact no value in the Item field.

I’ve updated the code to fix that and pushed version 1.0.6. Try that version and see how it goes.

Best Regards,
Keith

Hi @keith , thanks so much for the quick reply.

I’ve upgraded but still no juice here. I still get the same error as previously mentioned.
I should also mention I was getting the same error on the flow state list SSA as per below.

Huh. It’s possible that flow state single and flow state list share the same ID or something and so using them in the same workflow bugs out. Cuz it looks to me like the code for flow state list is being triggered here . Do you really need the Flow State Single here? Looks like you could just use result of Step One wherever you need it. Taking “:first item” isn’t really a complicated expression…

I don’t quite see why you’re using it.

Oh no, my bad for not explaining why. The main one for me is the flow state list SSA. I spent hours trying to work on what was going on, so I figured I’d try a simple test and use the flow state single SSA instead. Both of them reported the same errors.

I just tried it again now just using each SSA separately.

Getting the same errors.

My external API is setup as below in case that explains why it’s causing issues.

The response I’m pulling is an array of data within which multiple arrays may sit in.

I.e I’m pulling a list of invoices, but within those invoices, there’s an array of line items, payments applied etc.

So wondering if that’s causing the issue?

Hi Keith,
I rely on your plugin and I think it needs an update, can you please update this?
It takes extra time to load my app because a js is unable to load:

That’s not anything to do with List Popper.

That’s this, which isn’t me:

Oh great to know, thanks, that helped me figure out which plugin it is.

@matthew.walters I am getting this same error with List Pusher.

Did you figure out the solution, or get directions from @keith?

Perhaps we are using List Pusher incorrectly, and instead we should have List Pusher follow List Popper in a workflow, like in the demo – see workflow “Button Popper is Clicked”

Hi, I can’t solve a problem, can you help me?

I want to add repeated numeric values in a CUSTOM STATE.

Example: 1, 1, 1, 1, 50, 52, 53, 54

Help :frowning:

I’m using List Popper and Friends to loop through data from an external API and save it to the database (thank you @boston85719 for the advice and setting me on this path!)

I’m trying to understand how List Popper handles a situation where the list is missing an entry.

For example, the list from the API might look like this:

{
“_p_account_id”: “Rawxe4Mb6zik7v8Y6wVzuj65ywpOgMHy9P3x9”,
“_p_cost_basis”: 19.8, <<<<< this field is omitted in the next object
“_p_institution_price”: 11.87,
“_p_institution_price_as_of”: 1639612800000,
“_p_institution_value”: 47.48,
“_p_iso_currency_code”: “USD”,
“_p_quantity”: 4,
“_p_security_id”: “8wyZkVZm60sR65K5p0gxtn0jB5jZJatydow96”,
“_id”: “ea2e626b9da1ed255e098646d14e488d”
},
{
“_p_account_id”: “EPZqeJY01zcm8wYOezMZTX6r30gdjQHpd7DmQ”,
“_p_institution_price”: 1, <<<<<no cost_basis here
“_p_institution_value”: 75.77,
“_p_iso_currency_code”: “USD”,
“_p_quantity”: 75.77,
“_p_security_id”: “7dD8KV8owvUgk4Zqk1e3tLPy8Kyr9dFQbMyQQ”,
“_id”: “7960f90f5dbb5e2c141f2968ada168a5”
},

It seems that when the list is a text value, List Popper includes “null” for the missing entry in the “remaining list”. But when it is a number, it is removed and the remaining list is shorter.

This excerpt from the log shows the remaining list returned by List Popper with a “null” for the omitted entry.

This excerpt from the log (on a list of numbers) shows no “null” values, just a shorter list. FLOW State SSA does seem to preserve the null value, in both case, however.

I’m ending up with mismatched records in the database. Wondering if anyone has dealt with this or has any idea why this might be happening.

Thanks!

That is interesting. Not sure if that is expected behavior or not. @keith is this expected behavior?

Just pushed an update to List Popper and Friends that helps workaround an issue I recently discovered with Bubble lists and how they handle (or don’t handle) empty values.

Hey @boston85719 and @melissa7, this is what you were experiencing. Watch the videos to understand the problem and the solution I implemented in 1.1.0.

Hey, it’s time for some live Bubbling with Keith! I recently discovered that certain types of lists handle empty (null) values just fine, but that others don’t allow them. What!? While this may or may not be a bug, it’s certainly an inconsistency and Bubble should probably treat it like a bug.

At any rate, I implemented a workaround for this in my List Popper and Friends karma-ware plugin, which includes a few nifty Server-Side Actions for dealing with lists and stuff. I just published those changes as List Popper and Friends version 1.1.0. Update your plugin if you’re so inclined.

Let’s talk about it in these 2 derpy and unrehearsed videos, shall we? Part 1:

Part 2:

In addition to lists of numbers (which do not handle null values properly) and lists of dates (which do not handle null values properly), one I forgot to mention is BOOLEANS ("yes/no"s). Though this seems incredibly dumb – because false and null are both falsey – lists of yes/no’s can also not be constructed with nulls (when publishing, we have to convert the nulls to “false”).

I’ll also post posted this over in the “Bugs” category so more people can enjoy my ramblings.

Happy Bubblin’!
Keith

PS: Just a gentle reminder that, if you find List Popper and Friends useful and appreciate the fact that it gets the occasional update, you can support me here - grupz.com/karma!

1 Like

Thanks Keith! This is very cool. I’ll update my List Popper when I have a chance.

1 Like