Skip to main content
Nintex Community Menu Bar
Question

How can I get all of the record IDs from a model into a Javascript variable?

  • July 11, 2024
  • 3 replies
  • 21 views

Forum|alt.badge.img+4

var payableModel = skuid.model.getModel(‘Accounts_Payable’);
    var modelRows = payableModel.getRows();
    var selectedItems = modelRows.getField(“id”);

I would like “selectedItems” to contain all of the record IDs from the “Accounts_Payable” model.  Thanks in advance for any help!

This topic has been closed for replies.

3 replies

Forum|alt.badge.img+6
  • July 11, 2024

Hi Danny, You can use: Object.keys(payableModel.dataMap); Thanks. Gyan


Forum|alt.badge.img+4

Thanks, Gyan.  That did the trick.


Forum|alt.badge.img+13

Since dataMap is an internal cache, I would recommend using the following, which uses supported API methods:

var allRowIds = payableModel.getRows().map(function(row) {<br>&nbsp; &nbsp;return payableModel.getRowId(row);<br>});