I'm trying to use an example I found to work with my data. I have a Sign layer that will be collected with Field Maps. In that layer is a field called Parent_Asset_ID. I have another layer called County_Parks. Inside County_Parks is a field called Asset_ID. I need the Parent_Asset_ID to fill in with the Asset_ID from the County_Parks layer. This is what I did:
// Create a feature set using the 'County_Parks' layer in the map
var County_Parks = featuresetByName($map, 'County_Parks', ['Parent_Asset_ID'])
// Intersect the current location with the County_Parks and
// get the first park
var County_Parks = First(Intersects($feature, County_Parks))
// If the current location does intersect a feature,
// return the name of the County_Park. Otherwise, return null
if (!IsEmpty(County_Parks)) {
return County_Parks['Parent_Asset_ID']
} else {
return null
}