I need to restrict to insert a record into a table if it contains at least 1 record. This table must contain 0 or 1 record at all times. I’m using this table to store a value of one field (It’s a default value which is chosen in the parameters by a user).
I’m trying to do it in validateWrite() method of the table but I’m having trouble distinguishing when the record is inserted and when it’s updated. It must be available to update a record and it must be impossible to insert another record if there is at least 1 record in the table. Deletion can be possible or impossible, not that important.