Cross Site Lookup Cascade
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.
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.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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:
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);
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests