Cross site lookup filtered drop down

Discussions about Cross-site Lookup
Locked
miknon
Posts: 2
Joined: Fri Jan 31, 2014

31 Jan 2014

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?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

02 Feb 2014

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

miknon
Posts: 2
Joined: Fri Jan 31, 2014

04 Feb 2014

Worked perfectly. Thanks!

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests