create parent record and then child record on row action

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Can i create a parent record and child record on a row action?

I am displaying data from one object in a table. The table has a row action which should create a record in another object (Master) and then take the id of the newly created master record and create a record in the child object 
Photo of Vineet

Vineet

  • 492 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
You can absolutely do this. Your row action should "run multiple actions." Within it, you'll have two "create new row" actions.

Be aware that as soon as you create a row, the context for the rest of the action framework with be the newly created row.
Photo of Vineet

Vineet

  • 492 Points 250 badge 2x thumb
Thanks! that helped
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Also. Make sure the model for the parent record above the model with the child record.
Photo of Vineet

Vineet

  • 492 Points 250 badge 2x thumb
yes, i have it setup that way
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
You guys are great!  Vineet, let us know if you can work this out.  The context iss ue that Matt mescribes is an important gotcha. 
Photo of Vineet

Vineet

  • 492 Points 250 badge 2x thumb
Yes, it worked. Thanks Rob!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Glad to know..