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

I guess I can just go the " minus item: first item…” approach to this. Doing so still offers the “Traceability” and “Progress Indication” I thought only List Popper could afford… so long as my list of Users doesn’t include duplicates. But Bubble things pulled from the database always have unique IDs so that shouldn’t be an issue.

In the meantime, if anyone can confirm or deny that List Popper doesn’t work on the User field, I think that would be a good community contribution :slight_smile:

1 Like

I haven’t tried that @zelus_pudding, but I’ll look into it. There’s nothing fancy going on in List Popper — but you might want to upgrade to the latest version. Older versions only work with non-thing (primitive) data types, but I fixed that in more recent versions. That’s probably the issue as Users are of course Things.

1 Like

Hmmm, strange. I was pretty sure I tested it against the upgrade :thinking:

Hi @keith,

Would it be possible to support null values within a list?

Currently experiencing this error message:

Workflow error - Plugin action List Popper SSA error: TypeError: Cannot read property ‘object’ of null at LambdaListApi.get (/var/task/index.js:187:36) at eval (eval at build_function (/var/task/index.js:55:21), :1:53) at /var/task/index.js:296:23 at run_fn (/var/task/u.js:594:18)

@zelus_pudding Did you ever manage to figure out why List Popper was not returning anything when it comes to Users? I’m having the same issue!

Well, I just took a look at the code again and it seems that what was published did not work properly for lists that are Things (Users of course are Things).

I just published version 1.0.4. Upgrade and test that one out an let me know if it works properly. (I’ve not thoroughly tested it myself, but this should solve your problem. Please let me know either way.)

Thanks,
Keith

I did get it to work but can’t remember what the issue was. My best guess right now was perhaps I had forgot to set the right data permissions (though I’m not sure that was it).

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

You probably made it work by passing the Users as their unique IDs. But 1.04 should properly support Things now. (In all of the Actions in this plugin. I think the source of my confusion before was that I had added Thing support to one of the other Actions, but not to List Popper itself.)

1 Like

That was it!

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?