Add to thing to a list is overwriting the list

Hi. I’m trying to add an item to a list, but it’s overwriting the whole list. Is “add” the wrong function?

No… add is the correct operator to use here…

But something else in your workflow seems wrong…

Firstly, what exactly is it overwriting if you’re creating a brand new conversation? (surely there is nothing to overwrite)?

And secondly, what Conversation are you making changes to (you’re doing a search for one, which is likely incorrect - and probably what’s causing your confusion here).

Thank you for taking a look!

  • I’m creating a new conversation when the page loads
  • loading up a bunch of preset messages
  • Hitting the ChatGPT API to get the assistant prompt
  • then trying to add that response to the list of messages.

So, in step 7, i’m trying to make a change to a list that reside inside data type Conversation.

Does that make sense?

But which Conversation are you making changes to in step 7? (the one you created in step 1, or a previously existing one?)

I’m trying to add a message to the conversation crated in step 1.

In step for, I add 4 messages to the conversation. In step 5 I hit the API and it step 7 I’m trying to add the results of the API to the same converation.

In that case, the thing to change should be the result of step 1, not a search (doing a search won’t be reliable and is probably the cause of your issue here).

That said, why do you need to use two separate actions for this (one to create the conversation, and another to add the message to it?)? It would be more efficient, both in terms of performance and WUs, to do it all in a single step. (and why are you adding more messages in a backend workflow?)…

In any case, the issue is almost certainly a timing issue, either caused by doing a search in step 7 (instead of referring to the result of step 1), or by running some operations on the front end and others on the backend (i.e. step 4). If I were you I would consolidate all of that into a single workflow action.

Great stuff. Thank you. I’m adding more messages because I’m adding them in a loop and I couldn’t figure out how to do the loop in the front end. I couldn’t get a custom event to call itself. It’s all because I want to add 4 seed messages in order.

How could i do it all in one action?

This topic was automatically closed after 70 days. New replies are no longer allowed.