==============
select_records
==============

.. js:function:: select_records(source, fields)

**domain**: client 

**language**: javascript

**class** :doc:`Item class </refs/client/item_api>`

Description
===========

Use the select_records method to add records to an item by selecting them from the
lookup item of a field.

For example, this method is used in the Demo application to add tracks to an 
invoice by selecting them from Tracks catalog.

The ``field`` parameter is a field name of a lookup field of the item

Example
=======

.. code-block:: js

  function on_view_form_created(item) {
      var btn = item.add_view_button('Select', {type: 'primary'});
      btn.click(function() {
          item.select_records('track');
      });
  }
