Page 1 of 1

Field with spaces

Posted: 03 May 2016
by Wvgent
Hi all,

I'm having trouble adding a field with a space in it.
I'm trying to filter results in the lookup field by column Maatwerk 2 and contains the value 'Maat 1'.
The results from Maatwerk 2 all start with the items containing the value 'Maat 1'
But I keep getting the error "Failed loading".
This is my code below:
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$filter=startswith(Maatregel 2, 'Maat 1')&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')and startswith(Maatregel 2, 'Maat 1')&$top=10";
}

Re: Field with spaces

Posted: 03 May 2016
by Dmitry Kozlov
Hi,

Please, note that you have to use internal names of fields in the requests. You can find how to obtain internal names in the following thread:

https://social.msdn.microsoft.com/Forum ... mentlegacy