Updating Feature Service with schema changes to AGOL

2965
7
Jump to solution
08-09-2021 01:29 PM
KristalWalsh
Occasional Contributor II

Hi, could I get some advice on the “safest” way to proceed on making this update? I have just added new fields and made some minor changes to a couple domains in my FGDB which is the source of a feature service on AGOL. Until this week, I was using Append to update the FS with any changes that had been made but now end users have input some data.  I found one discussion posted about updates with views but I am not currently using views. At least one field has been added to every feature class in the FGDB which also has related tables. I don't want to overwrite any of the new data that has been entered in the last couple days. Thank you very much! Kristal

Kristal Walsh, Florida Fish and Wildlife
Office of Conservation Planning
2 Solutions

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Okay, that's what I thought, but your mention of subtypes made it a little unclear. Hosted layers don't currently support true subtypes, just simple domains on the fields. Those domains can be altered in AGOL from the item's Data tab if you go into the Fields view.

jcarlson_0-1628610153105.png

 

I will say, having worked with several similar situations, when a hosted layer is used for active editing, it's always a better idea to make your adjustments to the service itself. Of course, there are cases where the changes are so drastic that you can't, such as adding a new related table.

These cases are rare, but if you have to:

  1. Pick a time when your users are not accessing the service, or temporarily disable editing.
  2. Copy the entire service to a FGDB
  3. Make the necessary changes
  4. Republish and overwrite
  5. Re-enable editing
  6. Check to see that connected maps and apps are still functioning properly.

This approach ensures that all existing data is preserved.

- Josh Carlson
Kendall County GIS

View solution in original post

jcarlson
MVP Esteemed Contributor

Ah, the Smart Editor. We've had issues with that on some of our hosted layers in the past. It can be a bit of a pain to reconfigure, but I've always just removed the Smart Editor and re-added it.

To save yourself some time, you can open up the Web App's JSON using the AGO Assisstant and copy the existing configuration. You can search for widgets/SmartEditor to find it easier.

                "name": "SmartEditor",
                "version": "2.19",
                "closeable": true,
                "uri": "widgets/SmartEditor/Widget",
                "config": {
                    "editor": {
                        "layerInfos": [
                            {
                                "featureLayer": {
                                    "id": "Well_and_Septic_Layers_9519"
                                },
                               

 You can see that the layer is stored with a specific ID, and that always seemed to be the hangup for us. You can add a fresh new Smart Editor, connect the new feature layer, then save.

Open the JSON in AGO Assistant and paste in the copied configuration from before, but keep the layer ID of the new layer.

- Josh Carlson
Kendall County GIS

View solution in original post

7 Replies
jcarlson
MVP Esteemed Contributor

This kind of situation can get quite complicated. To avoid data loss, you're best bet is to add the new fields to the AGOL service so that the schemas match and use Field Calculate in Pro to update the attributes in the AGOL service.

- Josh Carlson
Kendall County GIS
0 Kudos
KristalWalsh
Occasional Contributor II

That's not encouraging to hear @jcarlson since our field management is always a work in progress and being improved by the feedback I receive from the field biologists. I can certainly add the new field in the FC in AGOL as you mentioned; maybe I can make the domain changes there also. It is sometimes very difficult to explain to them how domains/subtypes will look until they see it and use it. I listen to how things should work better and then make changes. The domain changes were minimal but will be more efficient in the long run and a couple new ones were added. I've just completed a complete restructure of the entire database recently to respond to the team's comments and really need a way to allow for realistic, possibly routine improvements. 

Kristal Walsh, Florida Fish and Wildlife
Office of Conservation Planning
jcarlson
MVP Esteemed Contributor

Is the layer in question a hosted feature layer, or is it referencing an enterprise geodatabase?

 

- Josh Carlson
Kendall County GIS
0 Kudos
KristalWalsh
Occasional Contributor II

The source is file geodatabase created in ArcPro published to a hosted feature layer containing 9 related feature classes and tables. Our staff use ArcGIS Online and Web Editor to add new features and data to the tables.

Kristal Walsh, Florida Fish and Wildlife
Office of Conservation Planning
0 Kudos
jcarlson
MVP Esteemed Contributor

Okay, that's what I thought, but your mention of subtypes made it a little unclear. Hosted layers don't currently support true subtypes, just simple domains on the fields. Those domains can be altered in AGOL from the item's Data tab if you go into the Fields view.

jcarlson_0-1628610153105.png

 

I will say, having worked with several similar situations, when a hosted layer is used for active editing, it's always a better idea to make your adjustments to the service itself. Of course, there are cases where the changes are so drastic that you can't, such as adding a new related table.

These cases are rare, but if you have to:

  1. Pick a time when your users are not accessing the service, or temporarily disable editing.
  2. Copy the entire service to a FGDB
  3. Make the necessary changes
  4. Republish and overwrite
  5. Re-enable editing
  6. Check to see that connected maps and apps are still functioning properly.

This approach ensures that all existing data is preserved.

- Josh Carlson
Kendall County GIS
KristalWalsh
Occasional Contributor II

Hi Josh, thanks for you detailed reply! I did make the changes online to the FS. There were no changes significant enough to warrant adding a new related table but our staff use the editor widgets via a web app and there seems to be alot of quirks with updating the web editor now. Nothing's ever easy. So I'm still at #6. Check to see connected maps and apps are still functioning. I can do this in my sleep, so I know it's the app. Have another call scheduled with ESRI tomorrow about the Smart Widget hanging up. Again, thank you for your time. I see your posts alot! Always appreciated. 

Kristal Walsh, Florida Fish and Wildlife
Office of Conservation Planning
0 Kudos
jcarlson
MVP Esteemed Contributor

Ah, the Smart Editor. We've had issues with that on some of our hosted layers in the past. It can be a bit of a pain to reconfigure, but I've always just removed the Smart Editor and re-added it.

To save yourself some time, you can open up the Web App's JSON using the AGO Assisstant and copy the existing configuration. You can search for widgets/SmartEditor to find it easier.

                "name": "SmartEditor",
                "version": "2.19",
                "closeable": true,
                "uri": "widgets/SmartEditor/Widget",
                "config": {
                    "editor": {
                        "layerInfos": [
                            {
                                "featureLayer": {
                                    "id": "Well_and_Septic_Layers_9519"
                                },
                               

 You can see that the layer is stored with a specific ID, and that always seemed to be the hangup for us. You can add a fresh new Smart Editor, connect the new feature layer, then save.

Open the JSON in AGO Assistant and paste in the copied configuration from before, but keep the layer ID of the new layer.

- Josh Carlson
Kendall County GIS