row action to run snippet on current row only


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.$,&nbsp; &nbsp; &nbsp;model = skuid.model.getModel('AccountTab'),<br>&nbsp; &nbsp; &nbsp;row = model.getFirstRow();<br>model.updateRow(row, {Favorite_date__c:''}); 

Thank you

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


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&nbsp;model = arguments[0]&#46;model,<br />&nbsp; &nbsp; &nbsp;row = arguments[0]&#46;row; model&#46;updateRow(row, {Favorite_date__c:''});

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.

Thank you Jeff and Matt,

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

Glad to help!