Hi, I'm not sure I'm even close with this script, so I'm hoping someone can help pull me through! The objective here is to intersect two features, pulling one id from one fc into another. The intersect part of the code works but when creating a second feature (per the form), as in a second property for an existing landowner, there is no intersect, so I just want the customer id from the related customer to be pulled into property fc. I know there's something missing, but I just don't know what or where to add it. Total Arcade novice here.
// Define a Featureset (Customers) from the layer "Customers" in the $map
// that contains the attribute ['CustomerID']
var Customers = FeatureSetByName($map, "Customers", ['CustomerID'])
// Define a variable (code) to store the value we want
// Get the value by Intersecting the polygon location
// with the FeatureSet "Customers", or Customers
var code = First(Intersects($feature, Customers))
// If the current location intersects Customers,
// return the value in the field ['CustomerID'].
// If no intersect, pull customer id into related feature layer [ProertyBoundary]
var relcustid = First(FeatureSetByRelationshipName($feature.CustomerID, "Customers_PropertyBoundary"))
if (!IsEmpty(code)) {
return code['CustomerID']
} else {
return Console(relcustid["CustomerID"])}
Kristal Walsh, Florida Fish and Wildlife
Office of Conservation Planning