Substringof not working in cross site lookup
I'm trying to do a simple cross site lookup and all I changed in the javascript is filter=substringof
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=substringof({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
And I get an error Loading Failed
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=substringof({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
And I get an error Loading Failed
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
I've copy-pasted your code in and it works fine for me. Open up your console (press F12), reload the page, expand the dropdown. You should get an error in the console. Copy-paste it here.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 9 guests