AnsweredAssumed Answered

Related table Foreign Key ID does not populate automatically in Collector or Web App

Question asked by zachbodenner on Nov 20, 2019

I'm having some trouble with related Foreign ID Keys not populating automatically when I create a new form.


My setup:


Tree Inventory (FC) - Definition Query 'Removed="no"'

Remove Trees (Same feature class as Tree Inventory w/ different definition query) - Definition Query 'Removed="yes"'

Tree Lead (Same feature class as Tree Inventory w/ different definition query)

Tree Inventory Form (Related Table)


Tree Inventory is related to Tree Inventory Form using "GlobalID" from Tree Inventory, and "Tree_ID_Rel" (a GUID) in the Form. The relationship is simple, one-to-many which is necessary because the form is a record of maintenance performed on each tree. 


My problem:


In Collector and my Web App, if I attempt to create a record of maintenance for an object in the Tree Lead or Removed Trees layers, the Tree_ID_Rel (Foreign Key ID) does not populate, resulting in an orphaned record. But, if I do the exact same thing for an object in the Tree Inventory layer, the Tree_ID_Rel populates with no trouble and my record is visible everywhere (Web App, Collector, Desktop). This seems strange to me since all of my three tree layers are the same feature class, related to the same table. No errors or anything obviously failing.


Some troubleshooting I've already tried:


If I create a record in the Tree Inventory layer, the Foreign Key ID populates, and remains populated if I then "move" the object it was created on to another layer (by editing the 'removed' field from "no" to "yes"). But, if I then try to create a record on that same object, the Foreign Key ID does not populate.

I've tried re-creating the FC to Form Relationship Class.

All of my Primary and Foreign Key fields are turned on in the MXD, Web Map, and Web App.


Now, the simplest work around would be to tell the folks who use this app that only the Tree Inventory layer can be edited, and to make sure that when a tree is removed to create the related record BEFORE changing the 'removed' field from "no" to "yes," but of course I'd much rather get to the bottom of the issue.


Thanks for the help!