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?

  • Jul 11, 2024 12:00 PM UTC
  • 3 replies
  • 68 views
  • Translate All

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
  • Jul 11, 2024 12:51 PM UTC

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

Translate

Forum|alt.badge.img+4

Thanks, Gyan.  That did the trick.

Translate

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>});
Translate