Cross Site Lookup Cascade

rss

Posted by Hubbaroo - Apr 2 ’14 at 06:17

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
    Member
    Member for: 8 years 4 months 2 days
    #1 by Hubbaroo Apr 3 ’14 at 06:03

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

     

    Thank you.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 4 months 2 days
    #2 by Dmitry Kozlov Apr 4 ’14 at 03:44

    [#1]: 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:

    var relationId = fd.field('Relation').control().value();
    if (!relationId) {
        relationId = 0;
    }
    alert(relationId);
    
  • Hubbaroo
    Member
    Member for: 8 years 4 months 2 days
    #3 by Hubbaroo Apr 4 ’14 at 04:05

    [#2]: I was using the wrong field name, thank you

Displaying 1 to 3 of 3 messages