How do I update a field value for a related table through Field Maps?

471
3
12-06-2022 09:06 AM
NathanR
New Contributor II

Hi! My map has the below layers:

  • Tanks (Layer)
  • Inspections (Table)

I have a form set up for where inspections can be performed. Inside the Tanks layer, there is a "Conformance" field. I need the inspection form to update this related field.

I've tried the below code. All have been no bueno. 

 

 

//test 1, object is immutable error
var tank = First(FeatureSetByRelationshipName($feature, "Tank"))
tank.Conformance = "success"

//test 2, object is immutable error
portal = Portal('https://XXXXX.maps.arcgis.com')
var gid = "{c33d5753-8219-4c55-9eg5-0d1b41c21104}"
var tank = First(Filter(FeatureSetByPortalItem(portal, '43ebf67a212448c9b57888562490093b', 0, ['*']), 'GlobalID = @gid'));
tank.Conformance = "success"

//test 3, works as att rule, not as arcade code in field maps
return {
    'edit': [{
        'className': 'Tanks',
        'updates': [{
            'globalID': $feature.tank_gid,
            'attributes': {
                'Conformance ': "success"
            }
        }]
    }]
}

 

 

Any help would be greatly appreciated. I've been stuck on this for days. Unfortunately, attribute rules will not be able to be used due to how the sharing of the data will need to be set up.

Tags (2)
0 Kudos
3 Replies
RobertBorchert
Frequent Contributor III

You will probably have to use Survey123

0 Kudos
NathanR
New Contributor II

I'm trying to get this working through a field maps arcade expression. 

0 Kudos
ShaunGibbins
New Contributor II

Did anyone figure this out please?

Does anyone know if you apply attribute rules to the layer in pro before publishing the service if this still works when the layer is used in field maps?