How to pass Id in onClick function inside template field

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have a template field inside which i have written some html code.

now onClick of template field link i want to pass id to the onClick function.

I am trying this , 

onClick = "openPrimaryTab({{{Id}}})"

but i am getting error - 

Uncaught ReferenceError: a1x190000007F1YAAU is not defined


And if i use {{{Id}}} in javascript function , i am getting same Id for every record , whereas i should get different id according to the row clicked . Hence i thought of above solution,but it is giving error.

Can someone help to reslove?
Photo of Sumeet Sangle

Sumeet Sangle

  • 452 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
I believe if you put your {{{Id}}} in quotes, you should get the desired behavior:

onClick = "openPrimaryTab('{{{Id}}}')"
Photo of Sumeet Sangle

Sumeet Sangle

  • 452 Points 250 badge 2x thumb
Thanks Matt! It worked:)