Cross Site Lookup Cascade

Discussions about Cross-site Lookup
Locked
Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

02 Apr 2014

I have 2 cross site lookups, 1 is the company info and the second is the realted contacts. Here is my code, not sure what I'm doing wrong but I am very new to this.


function (term, page) {
// Getting the selected country
var relationId = fd.field('Relation').control().value();
if (!relationId) {
relationId = 0;
}

// Filtering by the selected country
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Title/Id&$orderby=Created desc&$expand=Title/Id&$filter=Title/Id eq " + relationId + "&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Title/Id&$orderby={LookupField}&$expand=Title/Id&$filter=startswith({LookupField}, '" + term + "') and Title/Id eq " + relationId + "&$top=10";
}


Thank you again.

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

03 Apr 2014

What I need is a link to documentation on the structure of the script.


Thank you.

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

04 Apr 2014

Hello,

Your script seems to be correct. Please, make sure that the internal name of your company field is 'Relation'. Try to output it before passing into the request:

Code: Select all

var relationId = fd.field('Relation').control().value();
if (!relationId) {
    relationId = 0;
}
alert(relationId);

Hubbaroo
Posts: 60
Joined: Sat Sep 21, 2013

04 Apr 2014

I was using the wrong field name, thank you

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests