I need some help with coding a script to clone the last row of a grid. I've been through the scripting reference and several posts on the forum but I can't get the script to work.
I can create the new row but I'm having trouble extracting the data from the previous row. I can extract the data from a specific row e.g. item.grid[1] but I need to do this with the most recent row.
Can anyone post up an example of how to do this? I've tried using item.grid.length but I get a Cannot read property "FIELD" from undefined error.
Thanks in advance,
Ross
Solved! Go to Solution.
Solved by tony.mandatori. Go to Solution.
Well, I think I've done it:
var gridlength = item.grid.length;
item.grid[gridlength-1]
Next question, how do I change the content of a field in the previous row of the grid from "LIVE" to "SUPERSEDED"?
Thanks,
Ross
For Editting, here is an example that works with out-of-the-box change orders
item.grid[0].QUANTITY_ON_HAND=10
Adding is little different.
To get the previous row, use length-2.