auto-populate fields when adding related records

07-20-2015 02:16 PM
New Contributor III

Someone asked a similar question here with no replies so I'll ask it again in a different way.

Is it possible to auto-populate a field (in addition to the unique ID) from a parent feature service to a related record?

I currently have my unique ID auto-populating when creating new related records but I would like other fields to transfer to my related record as well. For example, I would like the manhole # and the serial # of the monitor to transfer from the original point feature service to the related table (maintenance records). Auto-populating fields would save the field-guys from typing this info over and over.


I've experimented with a few varieties of relationship classes without success. Any ideas would be great. Thanks

Message was edited by: Caleb Anderson

Contacted ESRI and was told by support that this is not possible

Message was edited by: Caleb Anderson

The best I could come up with for a workaround (after deep-diving into some other forums) is to move the data from the cloud to our local SDE. Our main brain GIS people will make the data available for collector and field collection work-flows will continue as usual. With the data stored locally, I can automate the following tool to "auto-populate" specified fields (field personnel leave the field blank and the tool runs nightly and replaced null values with data from a parent feature class field):


The "Calculate Field" in the above model builder tool has the following script:


I tried it out locally and it works but I haven't tried it through our SDE yet. There will have to be some coordination to make this happen but I don't see why it wouldn't work.

10 Replies
New Contributor III

I also would like to do this - preferably on AGOL

Occasional Contributor

How can this be done???

0 Kudos
by Anonymous User
Not applicable


I've recently come across this issue myself and found a github that populates a parent FC from a populated related within ArcGIS Pro's Attribute Rules: arcade-expressions/ at master · Esri/arcade-expressions · GitHub 

With a little tweaking I was able to reverse this to populate the related attribute table when populating the parent FC:

// This rule will update an attribute in the child table
// Build a relationship class from the Feature Class (origin) to the Table (foreign) based on GlobalID
// Store the child table globalID from the key field in the relationship class
var childGlobalID = $feature.ChildGlobalID;
if (IsEmpty(childGlobalID))
    return childGlobalID;

// force to upper as the sql is case sensitive
childGlobalID = Upper(childGlobalID);

// Using the GDB name, get the parent classes records and Global ID field
var child_class = FeatureSetByName($datastore, "DBname.owner.TableName", ["GlobalID", 'ChildTableFeatureName'], false);
// Filter the parent class for only related features
var parent_records = Filter(child_class, "globalid = @childGlobalID");

var updates = [];
var i = 0;
var new_value = 'UpdatedFieldValue';

// Loop through each  feature, create a dict of the Global ID and the new value date
for (var row in parent_records) {
    // If the parent row is null or has a different value, updated it
    if (IsEmpty(row['ChildTableFeatureName']) || row['ChildTableFeatureName'] != new_value)
        updates[i++] = {
            'globalid': childGlobalID,
            'attributes': {"ChildTableFeatureName": new_value}    

// Return the original value in the result parameter, as to not lost the entered value
// Using the edit parameter,  return the class and list of updates
return {
'result': childGlobalID,
'edit': [
            {'className': 'DBname.owner.TableName',
             'updates': updates

I have not been able to get this working for AGOL yet but I am trying. 

Esri Regular Contributor

Brady Ross support for attribute rules is currently limited to ArcGIS Enterprise feature services.

0 Kudos
by Anonymous User
Not applicable

Aha! Thanks Doug Morgenthaler‌! 

0 Kudos
New Contributor

Hi Brady,

I have come across your code and I believe it is the answer to my problem. Unfortunatelly I am not being very successful in applying it to my case which I think is a bit different.

I am working in ArcGIS Pro 2.7 and Portal 10.7.1.


So I have a feature class with GlobalID and Fields A and B. I have a relationship class of 1:M to a table (FK: ParentGlobaIID) with corresponding fields A and B.

When adding a new entry in the related table, I'd like to auto populate fields A and B with the values of A and B in the parent feature class.

I am sorry if this is obvious but I cannot make this work for me. Could you please help me out?


Thanks is advance!



0 Kudos
by Anonymous User
Not applicable

I was able to use the below code to success with Attribute Rules in ArcPro using Arcade.

After relating the two fields, only thing is you need to alter a value to initiate the change.


// first read out the Foreign Key of the Destination Table (Feature Class)
var fcID = $feature.F_streetnameid
// access the Orgin table (Table)
var tbl = FeatureSetByName($datastore, 'MasterRoadName');
// create a sql expression to query on Primary Key
var sql = "streetnameid = '" + fcID + "'";
var related_data = Filter(tbl, sql);
// count the resulting records
var cnt = Count(related_data);
// initiate a variable to hold the result
var results = "";

// check if there are related records found for the current ID
if (cnt > 0) {
// loop through related records
    for (var row in related_data) {
// read some data and create the line you want
        var line = row.roadpretype;
// add the line to the result
        results +=line;
} else {
    results = "Need Segment Table relate";
// return the result
return results;


0 Kudos
Occasional Contributor

@Anonymous User, did you create this rule in the related table attribute rules or the parent feature class? And what did you use for the UpdatedFieldValue? That should be a value from the parent FC, correct, so what should the syntax look like if this rule is being created in the related table list?

0 Kudos
New Contributor III

I'm wondering if anyone has made progress on implementing this in AGO / Field Maps?