Correct syntax for using internal column name?
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";
}
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";
}
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
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:
Though this will only load the value, you need to still do something with it to see it anywhere.
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";
}
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
I was wrong, updated answer here - viewtopic.php?f=5&t=2164&p=6894
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 11 guests