I'm trying to setup an attribute rule in ArcGIS Pro 10.9.1 that evaluates two GUID fields, crby_fpt_rel and crby_far_rel, in a sample point feature class for Null values. If both fields are Null, I would like Null to be returned. If either field is not Null, I would like to use the FeatureSetByRelationshipName function to pull the ft_alias from the parent feature class into the corresponding field. The sample point feature class is the child of two parent feature classes, feature_area and feature_point. The feature_area feature class is related (1:M) to the sample_point feature class using globalid/crby_far_rel; the feature point feature class is related (1:M) to the sample_point feature class using globalid/crby_fpt_rel.
The feature classes are all in the same EGDB. They are published to Portal as registered feature services, and used in Field Maps.
This is the script I built for use in the attribute rules for the ft_alias field. However, I'm receiving an error in Pro asking for an array or featureset for line 10 (var far = First(relarea)) or I get a 999999 error code. Additionally, Field Maps fails to submit sample points to the child feature class when the attribute rule is enabled.
var areaatt = $feature["crby_far_rel"];
var ptatt = $feature["crby_fpt_rel"];
var relin = "";
if ((IsEmpty(ptatt)) && (IsEmpty(areaatt))){
relin = Null;
} else if (!IsEmpty(areaatt)){
var relarea = FeatureSetByRelationshipName($feature,"EGDBName.DBOName.RelationshipName", ["*"]);
var far = First(relarea);
relin = far.ft_alias;
} else if (!IsEmpty(ptatt)){
var relpt = FeatureSetByRelationshipName($feature,"EGDB.DBOName.RelationshipName", ["*"]);
var fpt = First(relpt);
relin = fpt.ft_alias;
} return relin