Page 1 of 1

Correct syntax for using internal column name?

Posted: 02 Aug 2018
by kflorian
What is the correct syntax for using internal column name?

The internal column name is _x0030_3

How do I change the default "Request Items" and "Item Format" code to use the internal name instead of the {LookupField}

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=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}

Re: Correct syntax for using internal column name?

Posted: 03 Aug 2018
by Nikita Kurguzov
Dear kflorian,
Do you want to use this field additionally to the {LookupField} or instead of {LookupField}? If you want to use it instead, there really is no need to manually replace it. Cross-site Lookup automatically replaces {LookupField} with the internal name of the selected field when it sends a request. So, you can just use {LookupField} instead.

If you want to additionally load an extra field, you can add it by its Internal Name to the code, like this:

Code: Select all

function (term, page) {
  if (!term || term.length == 0) {
    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},_x0030_3&$orderby=Created desc&$top=10";
  }
  return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},_x0030_3&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}
Though this will only load the value, you need to still do something with it to see it anywhere.

Re: Correct syntax for using internal column name?

Posted: 03 Aug 2018
by Nikita Kurguzov
I was wrong, updated answer here - viewtopic.php?f=5&t=2164&p=6894