When filtering for data in a fetch, it’s possible to filter by fields of a table lookup item using the “$sl_lookupName_fieldOnLookupTable” sort of notation. I’m wondering if something similar exists to access a list lookup’s description. Since the UI for a list lookup field displays the “LookupDescription” but when accessing via api it returns the “LookupValue”. For my use case it would be useful to have both the value and the description returned in the api, so I was hoping there is a way to include this in the nwFields portion of the request. Is this possible without the need for using a logic block or other table call?
It’s possible to use nwFilter to specify a filter criteria of a related table but not to inherit related fields automatically. As far as I know, getting related fields requires creating a Join or performing a separate query. I believe this is true whether accomplished by the platform (as is done by client in the UI with the LookupDescription) or the caller.
Similar to the $sl used for Table Lookups, we have the $lu syntax for list lookups. This is commonly used by the platform client to perform sorts on List Lookup columns.
The $lu syntax will perform the operation against the description of the List Lookup. For example, if you include the $lu for a lookup field in the nwFields section of the request, you will get back the description of the list lookup in the form <LookupFieldName>_LookupDescription. If you use the syntax in the nwSort, the results will be sorted by the lookups’ description rather than value.
You may also use it in nwFilter. For example, having a filter for {$lu_LookupFieldName: "some lookup description"} and that will filter your lookup field for “Some lookup description” based on the Lookup’s descriptions.
However, this is unnecessary if the List Lookup’s definition has the Display option set to “Description” as the platform backend will automatically use the description when doing the nwFields and nwFilter operation. This is not the case for nwSort however as that will always sort based on the value, so you must use $lu if you want to sort on description. This is due to the mechanics of how these interact with our backend and the database.