FIlter out inactive lookup values
Posted: 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
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