Filter Cross Site Lookup by ContentType
Hello,
I have a CrossSiteLookup column that looks up a library for the title.
The CrossSite Lookup column should only display documents that have a specific content type.
I used the script (viewtopic.php?f=5&t=739&p=3001):
function (term, page) {
if (! term || term.length == 0) {
return "{WebUrl} / _ api / web / lists ('{ListId}') / items? $ select = Id, {LookupField} & $ orderby = Created desc & $ top = 10 &" +
"$ filter = ContentTypeId eq '0x010300C4DB8202DDA58A4B979AC8C1D217117D'";
}
return "{WebUrl} / _ api / web / lists ('{ListId}') / items? $ select = Id, {LookupField} & $ orderby = {LookupField} &" +
"$ filter = startswith ({LookupField}, '" + encodeURIComponent (term) + "') and" +
"ContentTypeId eq '0x010300C4DB8202DDA58A4B979AC8C1D217117D' & $ top = 10";
}
I have used the correct content type ID.
Then I dragged the CrossSiteLookup column onto the form (using Forms Designer).
However, the following error appears when the form is called: See attachement
When calling the form without the CrossSiteLookup column, no error appears.
What am I doing wrong? Is the filtering of the CrossSiteLookup supported until a certain version?
I have not yet checked the SharePoint logs.
Many Thanks!
I have a CrossSiteLookup column that looks up a library for the title.
The CrossSite Lookup column should only display documents that have a specific content type.
I used the script (viewtopic.php?f=5&t=739&p=3001):
function (term, page) {
if (! term || term.length == 0) {
return "{WebUrl} / _ api / web / lists ('{ListId}') / items? $ select = Id, {LookupField} & $ orderby = Created desc & $ top = 10 &" +
"$ filter = ContentTypeId eq '0x010300C4DB8202DDA58A4B979AC8C1D217117D'";
}
return "{WebUrl} / _ api / web / lists ('{ListId}') / items? $ select = Id, {LookupField} & $ orderby = {LookupField} &" +
"$ filter = startswith ({LookupField}, '" + encodeURIComponent (term) + "') and" +
"ContentTypeId eq '0x010300C4DB8202DDA58A4B979AC8C1D217117D' & $ top = 10";
}
I have used the correct content type ID.
Then I dragged the CrossSiteLookup column onto the form (using Forms Designer).
However, the following error appears when the form is called: See attachement
When calling the form without the CrossSiteLookup column, no error appears.
What am I doing wrong? Is the filtering of the CrossSiteLookup supported until a certain version?
I have not yet checked the SharePoint logs.
Many Thanks!
- Attachments
-
- error.png (22.57 KiB) Viewed 11291 times
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear RMIC,
Hmm, the error looks like one of the lookups on the form points to a non-existing list or library, or somewhere it cannot access. At least it looks similar to this. Make sure you don't have any lookups like that in the list.
You can try and delete the Cross-site Lookup column, see if it helps. You can also tell us more about its configuration, perhaps we can offer some solution.
Hmm, the error looks like one of the lookups on the form points to a non-existing list or library, or somewhere it cannot access. At least it looks similar to this. Make sure you don't have any lookups like that in the list.
You can try and delete the Cross-site Lookup column, see if it helps. You can also tell us more about its configuration, perhaps we can offer some solution.
Cheers
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Dear RMIC,
The issue is actually most likely connected to the Display Field that you've selected in the Cross-site Lookup. Name column is not supported by neither Cross-site Lookup, nor default Lookup. This functionality should work as long as you don't use Name as the Display Field - it's a technical field and is best left alone. Try to copy Name into Title column, and use Title for the Lookup instead.
The issue is actually most likely connected to the Display Field that you've selected in the Cross-site Lookup. Name column is not supported by neither Cross-site Lookup, nor default Lookup. This functionality should work as long as you don't use Name as the Display Field - it's a technical field and is best left alone. Try to copy Name into Title column, and use Title for the Lookup instead.
Cheers
-
- Posts: 4
- Joined: Sun Jan 27, 2019
Years updated per Daves comments.
Can anyone confirm the same filter is used on 67 and 68s?
Can anyone confirm the same filter is used on 67 and 68s?
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests