I have a collection that is created from submissions of a Wix form called “Course Booking Form”. I want to update one field in that collection to indicate a change in order status. I’ve had no problem doing this with a regular collection, but app collections are a bit different.
Unlike regular collections, the form collection ID (required for the update API) does not appear in its CMS settings, which are greyed out. Instead, I’ve had to infer it by hovering over the form collection folder so that a URL appears below, such as “…/contact12”, “…/jobApplication08”, or in this case “…/enterContest042”
I’m using this line to insert the data into this existing form collection:
wixData.update(“enterContest042”, toUpdate)
However, when I run the code I receive an error:
“Error: WDE0025: The enterContest042 collection does not exist. You cannot work with a collection using the Data API before it is created in the Editor.”
You should be able to click Open Collection, click on the row you want to edit, and edit it.
You cannot edit system created fields, such as ID or Creation Date. All the other fields you personally created should be as simple as click inside the cell and type something.
Sorry, should have made it clear that I’m trying to do this with code as an automated process.
Cheers.
Then can you share a copy of your entire code so we can see what you have tried?
From the one liner you provided so far, I can only assume your Booking form database has a collection ID name of
Which according to the error, seems to be incorrect.
Every item has an ID, you just have to toggle view on and off for the columns when you open the collection. No item can exist without an ID.
I don’t know what type of update flow you have, but I think you need to be using the Before Insert API instead of Update.
You are correct. Every collection & field has an ID. And usually you can easily check the ID of any collection by opening the Collection Settings. But form submission collections are different - the Collections Settings option is greyed out (see original pic) so you cannot see what the collection’s ID is.
As a workaround, I’ve hovered over the form collection and inferred its ID from the URL (in blue, bottom left of pic, says enterContest042). This technique works for regular collections, but maybe it doesn’t work for Wix form collections?
I read the beforeInsert() instructions, but I’m not entirely clear on what circumstances would require using a data hook instead of just insert(). Is it only needed when you need to make calculations or format the data on the fly? I’m just looking to insert a line of text into a blank cell to indicate an order entry is “paid”.
The screenshot you provided is of the wix dashboard. Different settings are greyed out there to prevent people from making unwanted changes that cannot be reverted. You need to view your collections from within inside the editor. That means open the editor, turn on dev mode, navigate to the side panel, click on databases, look for the form databases, click on settings, etc.
beforeInsert allows you to do anything to the item before that line gets saved, which means you can set the value of a specific column to be “paid”, and then it adds that as part of that same item record
insert will create a brand new item in a database. That means the if you trigger “insert “5 times to simply insert the word “paid”, then you will have 5 new lines in the database with the word “paid”, no other information .
But then again, i have no idea what your code looks like so it’s possible your coding is on the right track based on your goals.
1 Like
I actually forgot that you could find all collection IDs inside the editor in Developer mode. The collection name was right but when querying form collections must add the app folder, so “Forms/enterContest042” in this case.
Didn’t need a data hook, but you were right that using insert() would have added 5 blank lines except the word “paid”. Not what I intended. Instead, I used get() and update() and was able to achieve the result.
Happy to say everything is working now. Thank you.
1 Like
Excellent! Glad you found the solution!