Adding a new related record in a table

  • 1
  • Problem
  • Updated 5 years ago
  • Solved
Hi there,

We use a custom item to track our events (Events__c), and I'm trying to link another custom item to it (called Item__c) and display the related list in a table.  We wanted a many-to-many relationship, so I created a junction item called Itemlink__c.  I added a model to my page for Itemlink__c and then pulled in the field for the related Item__c.  Itemlink__c has a Master-Detail relationship with Events__c, and a lookup relationship with Item__c.

The problem is, when I add a new row to the table and pick the item to add, I get the error message "Required fields are missing: [Event]".  Shouldn't it automatically fill in whatever record I have open for the event field?

Thanks so much!
Photo of abfleis

abfleis

  • 392 Points 250 badge 2x thumb

Posted 5 years ago

  • 1
Photo of abfleis

abfleis

  • 392 Points 250 badge 2x thumb
Just want to make sure this doesn't get lost - thanks!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
How are you creating the relationship between the Item__c model back to the Events__c model?  If you are using a "field from another model" condition the "Event_c relation" field will be auto populated with the same proto ID that is used in the Event Model. 

Secondly - how are you saving? You should have a page title component with "Events__c" in context.  The Save and Cancel button should have the "Item__c" model as "additionally saved" 

Finally the model order should be Events__c and then Item__c.   You can drag and drop models in the model list. 

Let me know if all that helps. 
Photo of abfleis

abfleis

  • 392 Points 250 badge 2x thumb
Ah ha!  That fixed it.  Thanks again!