Pass argument from button to JavaScript Snippet

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I currently have a "Send Notification" button on a single record pop up. 

All I am trying to do is when someone clicks this button to pass the record ID to the javascript snippet. But I don't seem to understand on how I can achieve this. 

The current code.

var params = arguments[0], $ = skuid.$;


//var model = skuid.model.getModel('RnDVac'), row = model.getFirstRow();
var model = skuid.model.getModel('RnDVac'), row = model.getRowById();

var requestType     = model.getFieldValue(row, 'RequestType__c');
var requestID       = model.getFieldValue(row, 'Name');
var requestIDNumber = model.getFieldValue(row, 'DocID__c');
Photo of Paulo Correia

Paulo Correia

  • 264 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Paulo,

console.log(arguments) should help you find what you need.

I believe model = arguments[0].model and row = arguments[0].row, so you could do something like this to get the record id:

var model = arguments[0].model, 
row = arguments[0].row, 
id = model.getFieldValue(row,'Id');
Photo of Paulo Correia

Paulo Correia

  • 264 Points 250 badge 2x thumb
Thank you Matt, that is now working as expected.