I am trying to design a custom object which i'm wondering if there could be any best practices regarding object design. i.e.,
Custom object design: Single record with multiple fields or Many
records with a single field. Which design is the best. Experts suggestions or thoughts if any please advice.
Questions:
- Which of the following design is a best practice?
- Which one is the best performer like indexing, ease of accessing the records, etc.
- Which design would best suit for reporting purpose?
- Which gives less data storage and storage efficient?
Please suggest.
Custom Object Name: SAP User Subscription
An user can subscribe to multiple events such as Bill Block, Credit Block, Delivery Block, etc. And they can unsubscribe from any of the event type.
Design 1:
Fields:
User Name : Lookup relationship
Event Type: Text
IsActive: Checkbox
So, the records would be stored in the custom object as follows,
Design 2:
User Name: Lookup Relationship
Event Type 1: Text
IsActiveEventType1: checkbox
Event Type 2: Text
IsActiveEventType2: checkbox
Event Type 3: Text
IsActiveEventType3: checkbox
Event Type 4: Text
IsActiveEventType4: checkbox
So, the records would be stored in the custom object as follows,
Best Answer
The best solution would be to have an Event object and a many-to-many object (subscription?) which holds a lookup to the user and a lookup to the event. If an entry is in the subscription table then the user is subscribed to the event.