Page 1 of 1

Cross Site Lookup Cascade

Posted: 02 Apr 2014
by Hubbaroo
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.

Re: Cross Site Lookup Cascade

Posted: 03 Apr 2014
by Hubbaroo
What I need is a link to documentation on the structure of the script.


Thank you.

Re: Cross Site Lookup Cascade

Posted: 04 Apr 2014
by Dmitry Kozlov
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);

Re: Cross Site Lookup Cascade

Posted: 04 Apr 2014
by Hubbaroo
I was using the wrong field name, thank you