How to get merge field value in JavaScript when I use {{Name}} it does not give any value.

  • 1
  • Question
  • Updated 3 years ago
  • Answered
How to get merge field value in JavaScript, when I use {{name}} it does not give any value.
Ex: var name = {{name}}
Photo of khushboo

khushboo

  • 198 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
you can use merge syntax in javascript (here), but you're probably better off getting the value of the field through the skuid.model.Model api directly.
Photo of khushboo

khushboo

  • 198 Points 100 badge 2x thumb
I have checked the syntaxes, so if i want to get accounts data i can use below:
 var acc = skuid.model.getModel('Account');
//to get the particular row
var row = acc.getRowById({{id}});

but this is not working I am not able to get id value here...
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
The only way to use merge syntax in javascript is with skuid.idols.merge() or something similar. Javascript will not process merge syntax on its own. .getRowById() is looking for an id string. Generally, model.getFirstRow() is the way to go.