Upon creation of new row in a different model, does the context for merge syntax become that model and new row?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
If I have two "Create new row" actions in sequence, will the context for the second action be the row that I created with the first?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Yes, it will. The "Context" for actions is almost always the "parent", e.g. if you have a Row Action on a Table, then the context is the Table Row, or if you have a Table within a Drawer, the Drawer's context is the row in the Table that's opened --- but there's one Action type that "changes context": Create new row. When a "Create new row" action is run, the new row created becomes the new context row for any subsequent actions in that action sequence. 

We are looking in to ways in the future to allow the "original" context to be maintained and accessed via merge syntax while still allowing "new" context to be added in and accessed via merge syntax. At present, though, think of it as "there can only be one". There's only one immediate context row and model --- any other Models / Rows must be accessed via Global merge syntax, e.g. {{$Model.OtherModelName.data.0.Name}}
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Perfect. That was the answer I was hoping to hear. Thanks!