FIlter out inactive lookup values

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
devinmcmahon
Posts: 2
Joined: Sat Nov 24, 2018

17 Dec 2018

I have a Cross Site Lookup field looking up entries in a source table. The field also filters out lookup values based on the value of another field already Unit -> Equipment

So, customer wants to load a new list of equipment to use, and of course there are records that are already associated to the current Equipment so they need to stay in the table and be "deactivated"

Add a field to Equipment Called Active set current entries to FALSE, load new with Active = TRUE

So would this:

return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + "&$top=10"

Simply become something like this:

return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + " and Active eq TRUE" + "&$top=10"

Thanks

User avatar
AlexZver
Posts: 232
Joined: Mon Aug 27, 2018

20 Dec 2018

Hi!

I'm terribly sorry for a late reply.

Please do not forget to add "Active" field name to the "select" section, something like this:

return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Unit/Id,Active&$orderby={LookupField}&$expand=Unit/Id&$filter=substringof('" + encodeURIComponent(term) + "', {LookupField}) and Unit/Id eq " + unit + " and Active eq TRUE" + "&$top=10"

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests