Create default row when Drawer child table have no records in List view?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Is it possible to add "default row" when Drawer child table have no records for corresponding Account record in List view?
Photo of rajadurai k

rajadurai k

  • 360 Points 250 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Louis Skelton

Louis Skelton

  • 4,878 Points 4k badge 2x thumb
Hi!

You might be able to do this using render conditions. Here's one approach:

  1. Have a roll up summary on parent counting the number of child records
  2. Add a row action with 'run multiple actions' to your account table with a render condition that only displays the row action if the roll up summary count = 0. Add an additional action which creates a new row on your child model.
  3. Add a second row action to your account table with a render condition that only displays if the rollup summary count is greater than 0. Set this to just show your standard list without adding a new row to the model.

You may have to use separate models for the two row actions.

Forgive me if I misunderstood!
Photo of rajadurai k

rajadurai k

  • 360 Points 250 badge 2x thumb
Thanks for your reply
Photo of rajadurai k

rajadurai k

  • 360 Points 250 badge 2x thumb
Your understanding is correct. But I need to add the new row in Drawer expand action itself.
 
 For Example,
 I have the Account records in list view with Drawer table for child Contact records. When I click the  button to expand the drawer,  If a Account doesn't have any child contacts, I need to show the input  fields of contacts in drawer  action. 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Louis' idea is great! You could use javascript but one roll up with conditional rendering is easier to understand and implement.

You can get what you want. Both row actions should open the drawer. One does just this. The other has an additional action to add a row to the model used to used to display records in the component in the drawer. You'll only have to set the default value of the required reference field to ensure it gets into your drawer.