Cascaded lookup

Discussions about Cross-site Lookup
Locked
CI_Jack
Posts: 4
Joined: Mon Jun 11, 2018

11 Jun 2018

hi im having difficulty configureing my cascaded look up, the look up just has a spinning circle now.

please see the code I have used

function (term, page) {
// Getting the selected Company
var companyId = fd.field('Company0').value();
if (!companyId) {
companyId = 0;
}
// Filtering by the selected company
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Company0/Id&$orderby=Created desc&$expand=Company0/Id&$filter=Company0/Id eq " + companyId + $top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Company0/Id&$orderby={LookupField}&$expand=Company0/Id&$filter=startswith({LookupField}, '" + encodeURIComponent(term) +"') and Company/Id eq " + companyId + "&$top=10";

}

any help would be gratefully received

ragesoft
Posts: 50
Joined: Fri Feb 23, 2018

12 Jun 2018

Hi Jack,

there is a quotation mark and & missing here (first return if no filter is set):
companyId + $top=10";

correct:
companyId + "&$top=10";

maybe this is already the solution for you :)

CI_Jack
Posts: 4
Joined: Mon Jun 11, 2018

12 Jun 2018

Many thanks for your help, this worked! and I had missed a O from the last company0/id in the script

all working now though …. thanks again

J

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest