Default Collection Fields
Intro
Default collection fields in the web app automatically provide essential metadata like creation date, modification date, and unique identifiers.
The default collection fields include:
ID - the ID of the field
Created at - when it was created
Created by - the name of the creator
Updated at - when it was updated
This video will help understand all about the default collection fields. These are fields which are generated when you store your data/record(s) in DrapCode so you do not have to create them explicitly.
How to create default collection fields using events?
1. Create an Event to Save Data
You need to create an event to save the data and any other action as per your use case. Go to Events and choose Create Event. Name your event and click Create.
1.1 Configure the Event
In the event mention what it is supposed to do. Here in this case it you can choose the collection and ask it to save the data.
1.2 Add the Details
In the pop-up that opens select the collection you want to save the data. Then you can mention an alert message and how you want to save it (this is optional). Then choose Save to finish.
1.3 Page Redirect
Now you can choose to redirect the page.
1.4 Add Event Details
You can mention the page where you want it redirected.
2. Create an Event to Update Data
As above, craete an event to update data. In the event mention what it is supposed to do. Here in this case it you can choose the collection and ask it to update the data.
3. Bind the Collection to the Page
Go to the relevant page and in its Settings choose the colelction from the dropdown to which you wnat to bind it to. Then click Update to finish.
4. Bind the Event to the Collection Form
Go to Components. You can drop a two-column layout and a Collection Form. Open its Settings and choose the collection and the event to bind. Then Save the changes. Similarly, you can bind the other event to the other other as per the use case.
5. Test the Settings
To run your settings go to Preview and add new records and click Submit. This will add the new details and redirect you to the page you had set earlier.
6. View Default Data
Go to your collection and click on the eye icon. It will display all the default data associated with the collection.
Conclusion
One key benefit is streamlined data management, as default collection fields automatically provide essential metadata without manual input, enhancing efficiency within the web app.