Hoping the community here can lend a hand.
The goal: create a calculation attribute rule for a polygon feature class that extracts a value from the feature with which it has the largest overlap in another dataset. If a user creates a polygon I want the value of an underlying polygon to be used for an attribute in the edited datasets. However I want to have error controls in case the user creates a polygon that overlaps two of the underlying polygons. I want to extract the attribute from the polygon with which it has the largest overlap.
Current code:
var fsJurisdiction = FeatureSetByName($datastore, "jurisdictions", ["Jurisdiction"])
var fsJurisdictionIntersect = Intersects(fsJurisdiction, $feature)
var jurisdiction = First(fsJurisdictionIntersect)
if (jurisdiction == null) return {"errorMessage": "Not in a jurisdiction"}
return jurisdiction.Jurisdiction