Select to view content in your preferred language

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

11-20-2019 07:49 AM
MVP Regular Contributor

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!

0 Kudos
1 Reply
New Contributor III

Hi Zach,

I am having the same issue with my utility FCs to their related inspections (water hydrants, manholes and catchbasins)

Here's my setup and where I'm at:

Each map has the principle layer (unqueried) and the same layer labeled "Inspected  Last 3 Years" queried by date difference drawn above the plain layer. We do this to "mask" all if the assets that have already been inspected in the last few years to measure progress. What I was noticing in Collector but NOT in Collector Classic is that it would only auto populate the queried layer. In the case of all of my service definitions the first layer to publish/top layer in order of drawing in Arcmap was the date difference queried layer.

So in short: I think it has to do with the order of the original service definition, you can look in the REST service directory and see which layer is going to be auto populated - open the inspection table link and look for "Relationships".

Here is the original service order :

My only solution so far is to republish with the drawing in order of what I need and then change the drawing order back in AGOL. 

-- ---------------------------

I wish I could know how to edit the related layer number and not have totally republish. Anynone.......Bueller.......Bueller.....Bueller

0 Kudos