Forum Academy Marketplace Showcase Pricing Features

Schedule API workflow on a list to add to a Thing's list

Hi, i have a problem with liking records to other record with relationship one to many.

  1. I have an API call which gives me:
    [ { "Headline": "<headline>", "Subtitle": "<subtitle>", "Content": "<content>" }, { "Headline":"<headline>", "Subtitle":"<subtitle>", "Content":"<content>" } ]

  2. I create new top level ContentGeneration record (has a field ContentVersions - list)

  3. I create a Scheduled api workflow ona list of that api call result.

  4. that backend api workflow gets the variables Headline, Subtitle, Content and record of ContentGeneration

  5. that backend api creates new ContentVersion with Headline, Subtitle and Content and then make changes to input ContentGeneration by adding ContentVersion to it.

The problem.
2 ContentVersions are created, but only the last one is added in ContentGeneration.

How do i link more ContentVersions to field list of ContentGeneration?

1 Like

likely you would want to do recursive backend workflows

I agree unfortunately recursive workflow cannot be done over the API result datatype - only over the DB type…

I think Bubble has problem scheduling the tasks somehow… When the result list’s elems are short, it links all the elements, but when the elems are longer, it doesnt have time to add them, and probably the workflow triggers another elem to link and so on.

I do it all the time by setting the parameter type of backend workflow to be text.

ok nice, and how do you parse the json in the backend workflow?

I do it when I schedule the backend workflow. I setup the parameters on the backend workflow to be list of text…in your example I’d have Headline, Subtitle, Content as the 3 parameters, all three would be list of text.

When you schedule the backend workflow, you can reference the previous step (which should be your API call) and use the dynamic expression composer to say each items Headline for example when setting the values for the Headline parameter.

Then in the backend workflow I use the List Popper and Friends plugin for the SSA action of Pop Item (which unfortunately with new pricing adds WUs expense, but from my experience has been the simplest way to move through a list of things like this)…I’d have my backend workflow setup with 3 SSA actions to begin, by popping the first item off the Headline, Subtitle and Content lists, then use a workflow action to create a thing and use the results of previous steps to fill in the appropriate values (previous steps being the 3 SSA actions)

I don’t think that I ever ran into an issue with one of the array values being empty (for example content is empty but Headline and Subtitle are not) causing an issue in data getting saved properly as I believe scheduling the backend workflow and using each items value from the API call, if it is empty, it is sent as an empty value, but is not removed from the list, so you should have equal numbers of each…however, if you did see that you could use a :is empty operator on the each items value (API call results each items Headline etc) and and :is empty yes value to ‘empty’ and no value to the actual value…then you’ll for sure have equal numbers in the lists sent via schedule backend workflow.

1 Like

Thanks alot! That is exactly what i was looking for <3

1 Like