row action to run snippet on current row only

DaveDave 💎
edited May 20, 2017 in Questions

I wonder if anyone could help me with that.

I have this snippet that i want to use as Row Action to clear a Date field's value 
But not really sure how to get it to work on current row from which i clicked the action

This work well for 1st record of a table or on a detail page. But not on any row after the first one

I Understand it's because of 'model.getFirstRow()'  but looking at the model api documentation, I could not find what I should use instead
var $ = skuid.$,     model = skuid.model.getModel('AccountTab'),
     row = model.getFirstRow();
model.updateRow(row, {Favorite_date__c:''});
Thank you


  • edited February 10, 2017
    Hey Dave! I believe I may be able to point you in the right direction here, but I'm also fairly new to the Javascript world.... In your snippet on the row you could select the specific row in say a Contact List for example by setting your variable to: //This variable selects the rows Id field. var contactId = params.item.row.Id; Technically with this then you could set your variable to a value in the row and then run the updateRow method on it. Thanks, Jeff Rutter
  • Matt SonesMatt Sones 💎💎💎
    edited April 17, 2018

    If you're running the snippet as a row action, your snippet should get passed the 'row' as one of the arguments.
    You can use something like this:
    var model = arguments[0].model,
         row = arguments[0].row; model.updateRow(row, {Favorite_date__c:''});
  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    On second thought, you might need to use arguments[0].item.row, as Jeff said.

    Just add a console.log(arguments); at the beginning of your snippet, then run it and take a look at your console to see what arguments are available.
  • DaveDave 💎
    edited January 27, 2017
    Thank you Jeff and Matt,

    As per Matt's last post , That Worked perfectly!

  • edited February 10, 2017
    Glad to help!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!