Fill XY attributes from point feature geometry with Arcade
A minimal example for updating XY attribute values in a geodatabase via an Arcade attribute rule.
var geom = Geometry($feature)
if ($editcontext.editType == "UPDATE" && Equals(Geometry($originalfeature),geom)) {return}
if (IsEmpty(geom)) {return {"result":{"attributes":{"X":null,"Y":null}}}}
else {return {"result":{"attributes":{"X":geom.X,"Y":geom.Y}}}}
If the feature is being updated but the geometry did not change, there is no change in the fields values.
If the geometry is empty, the fields are updated with empty values to reflect that.