I created a bit of a workaround for this if anyone is interested. I would imagine this workaround is not practical or applicable for all use cases, but it is still something. I literally have not tested this offline, but I see no reason why it would not work, since the table in question could be synced and available offline. (I will test that in the coming weeks, but I figured the concept was worth sharing.)
For an unrelated task, I created a table with key (field) names, and lookup values to search for, then "value" field names, and values to return. I initially put last_edited_user to try and populate this, but that only hits the form on submit (so it couldn't actively apply from the lookup table.)
Instead, I used the GetUser($layer) [thanks for that formatting by the way], and searched on the table I added to the form.
var result = null // set the result variable to null so this expression will return null if the search field is empty/null
var key_name = 'key_name' // the field that contains the keys which are field names that will be used in the FeatureSet filter
var key_lookup = 'key_lookup' // the field that contains the lookup value from the form
var lookup_field = 'lookup_field' // the field that we will search on which contains field names as values
var lookup_value = 'lookup_value' // the field that contains the desired value
var lookup_fields_of_interest = [key_name,lookup_field,key_lookup,lookup_value] // the list of the fields of interest which are set above
var key_name_search = "last_edited_user" // the lookup value used to filter the FeatureSet --> key_name=@key_name_search
// in a sense, key_name_search is a nested key found in the key_name field
// key_name _search is also the field in the form we're interested in
var lookup_field_search = 'toughpad_user' // the value to look up in the lookup_field --> lookup_field=@lookup_field_search
var username=GetUser($layer).username // only used for searching on the logged-in username
// if(!(IsEmpty($feature[key_name_search]))){ // code to use if searching for a field in the form (which matches the key_name field in the table)
if(!(IsEmpty(username))){ // code to use if searching for the username of the logged-in user
var search_value = username // the field in the form/feature used for the lookup --> key_lookup=@search_value
var lku_fset = FeatureSetById($map, /* LKUs Table Feature Service - treatment lkus tbl */ "18f0b3902e4-layer-30",lookup_fields_of_interest,false)
// had to explicitly name the field in the filter, using @Variable for the field name was not returning the proper values
// tested if variable name matching the field name mattered, it did not, could not use @Variable for the field name in the filter
// MG - 2024-04-23
result = First(Filter(lku_fset, 'key_name=@key_name_search AND lookup_field=@lookup_field_search AND key_lookup=@search_value'))[lookup_value]
// }
}
return result
Mitchell Grafstein, Horticultural Inspector 1, NYS Dept. of Agriculture and Markets