Cross site lookup filtered drop down

rss

Posted by miknon - Jan 31 ’14 at 07:09

We installed the cross site lookup for O365.  We want to filter the lookup based on a static value.  For example, the lookup list has 2 columns: Customer and Status.  We created the cross site lookup field "Customer" in our Project list.  However, we only want to show customers where Status = "Active".  How can we do this?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 2 months 8 days
    #1 by Dmitry Kozlov Feb 2 ’14 at 04:07

    Hello,

    Please, open Cross-site Lookup management dialog and expand Advanced settings section. Put the following code into 'Request items' area:

    function (term, page) {
      if (!term || term.length == 0) {
        return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Status\
            &$orderby=Created desc&$filter=Status eq 'Active'&$top=10";
      }
      return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Status\
            &$orderby={LookupField}&$filter=startswith({LookupField}, '" + term + "') \
            and Status eq 'Active'&$top=10";
    }
    
  • miknon
    Member
    Member for: 7 years 9 months 26 days
    #2 by miknon Feb 4 ’14 at 08:46

    Worked perfectly.  Thanks!

Displaying 1 to 2 of 2 messages