When in Javascript how do I reference the model within the context of the button activating the script?

  • 1
  • Question
  • Updated 2 years ago
  • Answered
Within a title block referencing a specific model I have a button that calls an inline javascript snippet. I would like to reference the Model that is within the context of the Title block that the button call is coming from.

For example if the Title Block is referencing a Model called MyAccounts then what javascript would I use to get the Model MyAccounts dynamically?

If I were calling a snippet from within a Row I could use something like arguments[0].item.

But I am not sure what the syntax should be for what I am attempting.
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 292 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Second line.

var params = arguments[0],
	model = params.model,
	$ = skuid.$;
 
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 292 Points 250 badge 2x thumb
Thank you. It was exactly what I needed.