Substringof not working in cross site lookup
Posted: 04 Dec 2015
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