# API workflow on a list in my database not adding all to the actual list item

**URL:** <https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361>\
**Category:** APIs\
**Created:** [May 15, 2024, 8:11am UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361 "2024-05-15T08:11:27Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![sawan](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sawan](https://forum.bubble.io/u/sawan)\
**Post date:** [May 15, 2024, 8:11am UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/1 "2024-05-15T08:11:27Z")

</div>

Hi everyone, I am trying to create a list of tasks from a list data type. I need all tasks to be added to a list data type after. I run an API workflow to create this and it creates all the task items but on the list it only adds 2 or 3 randomly each time i try. If I look at the list data type where it shows which tasks are added to it it confirms the same just a few. However each task data type has its related list unique ID on it.  
On the API workflow after it is created I do have an action to add the tasks to a list but maybe its wrong, any guidance would be lost appreciated please

 ![backend api workflow](https://us1.discourse-cdn.com/bubble/original/3X/7/0/7019fe87f86ab652ee98b737a4f77c39ff8a197f.png)

---

<div class="post-metadata">

**Author:** ![alex.esposito.1108](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/alex.esposito.1108/32/191677_2.png) [@alex.esposito.1108](https://forum.bubble.io/u/alex.esposito.1108)\
**Post date:** [May 15, 2024, 8:18am UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/2 "2024-05-15T08:18:22Z")

</div>

Which operator are you using on the second step? Add to list or set list?

---

<div class="post-metadata">

**Author:** ![sawan](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sawan](https://forum.bubble.io/u/sawan)\
**Post date:** [May 15, 2024, 8:30am UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/3 "2024-05-15T08:30:29Z")

</div>

Hi Alex, thank you for replying, its add to list

---

<div class="post-metadata">

**Author:** ![msgiblin](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/msgiblin/32/119904_2.png) [@msgiblin](https://forum.bubble.io/u/msgiblin)\
**Post date:** [May 15, 2024, 4:46pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/4 "2024-05-15T16:46:30Z")

</div>

Someone else had this issue (as did I) and this was my approach to solving it:

> [@Inconsistencies in "Add to List" Actions Within Scheduled API Workflow on a List of Things](https://forum.bubble.io/t/inconsistencies-in-add-to-list-actions-within-scheduled-api-workflow-on-a-list-of-things/317238/5):
>
> I ran into the same issue, and I accomplished it by doing a count of the things created, and waiting until that matched the count of things that were scheduled, and when those values matched, it then adds all of those items to the thing in one action.

---

<div class="post-metadata">

**Author:** ![sawan](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sawan](https://forum.bubble.io/u/sawan)\
**Post date:** [May 15, 2024, 5:13pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/5 "2024-05-15T17:13:34Z")

</div>

Hi, thank you for your reply, its been driving me mad all day. Would you please send me a screen shot of what that action looked like please and is it placed in the API workflow or back at the workflow where the API workflow was triggered from, I would be most grateful.

---

<div class="post-metadata">

**Author:** ![msgiblin](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/msgiblin/32/119904_2.png) [@msgiblin](https://forum.bubble.io/u/msgiblin)\
**Post date:** [May 15, 2024, 6:32pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/6 "2024-05-15T18:32:26Z")

</div>

So my example is on a recipe page where users can edit recipes:

1. When ‘Edit recipe’ is clicked, I generate a random number and set a custom state to that number:  

2. When they click ‘save’, it schedules the API workflow on the list, and I have a field on the items created from the API workflow to include this random number:  

3. (on front-end but in theory could handle in backend as well) - I have a workflow: `When repeating group's list of things:count is Search for (things created with the custom state's random number):count`

4. I have a step on this workflow that finds those items created (again, by searching for the custom state’s random number) and Sets List - note that the ‘Sort’ field is a value of Index I pass to the backend, so that when the things are inevitably created out of order, they’ll still get set in the proper order:

---

<div class="post-metadata">

**Author:** ![sawan](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sawan](https://forum.bubble.io/u/sawan)\
**Post date:** [May 15, 2024, 8:20pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/7 "2024-05-15T20:20:12Z")

</div>

Hi, thank you for this, I have read through it a couple of times and decided I better try this in the morning on a fresh mind, so I do not break anything 🙂 My need is to just get this API to create 27 tasks and then add them to a list, but I end u with a random number each time I try so it seems the add to list happens before the task creation is over.  
I will try this, one question also , how do you add a delay between steps on a backed work flow I wondered if I should try that also since I only have 27 tasks?

---

<div class="post-metadata">

**Author:** ![msgiblin](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/msgiblin/32/119904_2.png) [@msgiblin](https://forum.bubble.io/u/msgiblin)\
**Post date:** [May 15, 2024, 8:46pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/8 "2024-05-15T20:46:15Z")

</div>

> [@sawan](#):
>
> My need is to just get this API to create 27 tasks and then add them to a list, but I end u with a random number each time I try so it seems the add to list happens before the task creation is over.

Yes, this is called race conditions, and what’s happening is it’s creating the items so fast that it’s missing that next step. My solution above would solve this for you by waiting until all tasks are created first, and _then_ adding those to the list all in one move - it’ll save you WU as well.

> [@sawan](#):
>
> how do you add a delay between steps on a backed work flow I wondered if I should try that also since I only have 27 tasks?

That’s delay is set on the front end in the workflow step that schedules it:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/f/f/ff7d1193a89a2a6a4a7daf0cdcbb656d9d021d6c.png)

---

<div class="post-metadata">

**Author:** ![hermeticbeing](https://avatars.discourse-cdn.com/v4/letter/h/dfb087/32.png) [@hermeticbeing](https://forum.bubble.io/u/hermeticbeing)\
**Post date:** [May 15, 2024, 8:55pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/9 "2024-05-15T20:55:25Z")

</div>

I’ve had this problem for almost 2 weeks now of Bubble not adding the full list of items to the database from Schedule API workflow on list. I contacted them last friday with the issue and they’re still working on fixing it seems to be

---

<div class="post-metadata">

**Author:** ![hermeticbeing](https://avatars.discourse-cdn.com/v4/letter/h/dfb087/32.png) [@hermeticbeing](https://forum.bubble.io/u/hermeticbeing)\
**Post date:** [May 15, 2024, 8:58pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/10 "2024-05-15T20:58:23Z")

</div>

this is crazy they’ve had this issue since April 11th and its still not fixed

---

<div class="post-metadata">

**Author:** ![sawan](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sawan](https://forum.bubble.io/u/sawan)\
**Post date:** [May 15, 2024, 9:17pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/11 "2024-05-15T21:17:46Z")

</div>

Thank you for this guidance, your main solution sounds like the way to go but your example is more complex than mine, so I will try it in the morning. I don’t think I need to add any extra fields to my database or create custom states by the sounds of it but I will read again in the morning to be sure.

---

<div class="post-metadata">

**Author:** ![sawan](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sawan](https://forum.bubble.io/u/sawan)\
**Post date:** [May 15, 2024, 9:18pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/12 "2024-05-15T21:18:55Z")

</div>

I’ve struggled for two whole days on this.

---

<div class="post-metadata">

**Author:** ![msgiblin](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/msgiblin/32/119904_2.png) [@msgiblin](https://forum.bubble.io/u/msgiblin)\
**Post date:** [May 15, 2024, 9:22pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/13 "2024-05-15T21:22:32Z")

</div>

If you follow my solution, the one thing you’ll need to add is a field on the datatype you’re creating with the Schedule API workflow: the field that stores the randomly generated value. I used type text, and generated a value with a random combo of numbers and letters with characters:

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/7/f/7f86318378540ecaec1a935a2e3039de558b5a1c.png)

---

<div class="post-metadata">

**Author:** ![hermeticbeing](https://avatars.discourse-cdn.com/v4/letter/h/dfb087/32.png) [@hermeticbeing](https://forum.bubble.io/u/hermeticbeing)\
**Post date:** [May 15, 2024, 9:25pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/14 "2024-05-15T21:25:35Z")

</div>

yeah i was working on it for like 4 days before i came to the conclusion im not doing anything wrong and then contacted them. seems like they’ve been having a lot of issues lately.

i wonder if it has anyhting to do with the updated editor they dropped

---

<div class="post-metadata">

**Author:** ![sawan](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sawan](https://forum.bubble.io/u/sawan)\
**Post date:** [May 15, 2024, 9:26pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/15 "2024-05-15T21:26:50Z")

</div>

Im definately going to try your solution, update you in the morning and thank you soo much for making time and supporting me

---

<div class="post-metadata">

**Author:** ![sawan](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@sawan](https://forum.bubble.io/u/sawan)\
**Post date:** [May 18, 2024, 5:35pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/16 "2024-05-18T17:35:42Z")

</div>

I can confirm Recursive worked out perfect and is fast, thank you for the help, @msgiblin

---

<div class="post-metadata">

**Author:** ![pachocastillosr](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/pachocastillosr/32/154570_2.png) [@pachocastillosr](https://forum.bubble.io/u/pachocastillosr)\
**Post date:** [October 31, 2024, 5:13pm UTC](https://forum.bubble.io/t/api-workflow-on-a-list-in-my-database-not-adding-all-to-the-actual-list-item/322361/17 "2024-10-31T17:13:13Z")

</div>

> [@\[Feature Enhancement\] Schedule 100k Workflows with Schedule API Workflow on a List](https://forum.bubble.io/t/feature-enhancement-schedule-100k-workflows-with-schedule-api-workflow-on-a-list/314892/68):
>
> I can confirm “schedule api workflow on a list” is still buggy, some times it skips items from the list. For example, when it is a list of texts and each text is different. Setting 2 seconds interval didn’t work, 5 seconds seem to be working for now. However, it would be nice to be able to run parallel workflows reliably, for faster processing. Hope this can be fixed soon.
