============
lookup_field
============

.. js:attribute:: lookup_field

**domain**: client 

**language**: javascript

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

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

Use ``lookup_field`` to check if the item was created to select a value for
the lookup field. See :doc:`Lookup fields </programming/data/lookup_fields>`

Example
=======

.. code-block:: js

  function on_view_form_created(item) {
      item.table_options.multiselect = false;
      if (!item.lookup_field) {    
          var print_btn = item.add_view_button('Print', {image: 'icon-print'}),
              email_btn = item.add_view_button('Send email', {image: 'icon-pencil'});
          email_btn.click(function() { send_email() });
          print_btn.click(function() { print(item) });
          item.table_options.multiselect = true;
      }
  }  

