I have a polygon hosted feature layer along with a related table in ArcGIS Online. The layer and table are related via GlobalID and ParentGuid.
I'm attempted to add a calculated expression through forms on map viewer, and what i'm trying to achieve is that when a related record is added, the surveyor must add a "Status" on the related record. I'd then like the calculated expression to be against the "Status" field on the feature layer, and when the related record is added, the following expression will update the "Status" on the feature layer of the "Status" on the related record.
My expression is successfully executing but is always returning null, which I assume means it can't find a match between GlobalID and ParentGuid, but a quick check on the table reveals there are matches and this can also be proven by clicking on the popup to reveal the related records.
var relatedRecords = FeatureSetByName($datastore, 'Test_Log', ['Status'], false);
var parentId = $feature.GlobalID;
for (var record in relatedRecords) {
if (record.ParentGuid == parentId) {
return record.Status;
}
}
return null;
Any help would be great!