Page 1 of 1

Cross site lookup filtered drop down

Posted: 31 Jan 2014
by miknon
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?

Re: Cross site lookup filtered drop down

Posted: 02 Feb 2014
by Dmitry Kozlov
Hello,

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

Code: Select all

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";
}

Re: Cross site lookup filtered drop down

Posted: 04 Feb 2014
by miknon
Worked perfectly. Thanks!