Select to view content in your preferred language

Field Maps Templates Unexpectedly Linked After Duplication

155
2
a month ago
NoeliaVolpe
Occasional Contributor

Hi! I am having a weird issue with two Field Maps, one of which I created by duplicating the other. The only major difference between them is the geographic region: one is for an island, and one is for the mainland.

To ensure the island Field Map didn’t show mainland points, I applied a filter based on a field (Area) that specifies the location. To simplify the workflow for users, I created a template in each Field Map so that new points would automatically be assigned either "island" or "mainland" in the Area field. This worked perfectly fine.

However, today I noticed that one of the Field Maps was showing template options from the other. When I modified the template in one map, the changes also appeared in the other. It turns out that the templates are somehow linked—any change I make in one Field Map is automatically reflected in the other (see video below). I tested this by duplicating other maps, and their templates are also linked.


 
My questions:
  • Why are the templates linked between duplicated Field Maps?
  • Was there an update that introduced this behavior?
  • How can I separate the templates so they remain independent?
 
Thanks!

 
 
Side note: The only reason I duplicated the Field Map was to avoid manually recreating a complex form with linked tables, as it contains many fields and pop-ups that would take a long time to reconfigure. Because of this, I was forced to work with the same hosted feature layer for both maps. Ideally, I would prefer to have a separate layer for each region without losing the form configuration. If anyone has a solution for that, I’d love to hear it!
 
0 Kudos
2 Replies
DavidPike
MVP Notable Contributor

i think your feature templates exist at the Hosted Feature Layer level.  I've not done much with Field Maps but it seems the Templates tab is just another way to access and edit them.

maybe you could create 2 Hosted Feature layer views for Island and Mainland and have different templates for each, but I've not tested that to see if possible.

Clubdebambos
MVP Regular Contributor

Hi @NoeliaVolpe,

I agree with @DavidPike, create two views from the hosted feature layer, one for mainland and one for the island. You can then alter the templates of the views separately.

Using the ArcGIS API for Python, I export my forms to a JSON template, I can then reapply these across multiple maps where the same layer/schema exists, saving the need to re-do complex and lengthy forms over and over again.

You could probably achieve similar with AGO Assistant, grab the form definition from one WebMap and apply to another.

Here's the Python to export to a JSON template

from arcgis.gis import GIS
import json

agol = GIS("home")

wm_item = agol.content.get("WM_ITEM_ID")

wm_item_data = wm_item.get_data()

form_output_fldr = r"C:\Path\to\where\forms\stored"

layer_name = "INSERT LAYER NAME AS APPEARS IN THE WEBMAP"

## if you want to export for a table change operationalLayers to tables
for lyr in wm_item_data["operationalLayers"]:

    try:
        form_output_file = f"{form_output_fldr}\\{lyr['title']}.json"

        form_def = lyr["formInfo"]

        with open(form_output_file, 'w', encoding='utf-8') as f:
            json.dump(form_def, f, ensure_ascii=False, indent=4)
    except KeyError:
        print(f"No form for {lyr['title']}")

 

Here's the Python code to insert into another WebMap

from arcgis.gis import GIS
import json

agol = GIS("home")

wm_item = agol.content.get("WM_ITEM_ID")

wm_item_data = wm_item.get_data()

json_definition_file = r"Path\to\JSON\definition\for\form"

layer_name = "INSERT LAYER NAME AS APPEARS IN THE WEBMAP"

try:
    ## if you want to import for a table change operationalLayers to tables
    for lyr in wm_item_data["operationalLayers"]:
        if lyr["title"] in layer_names:
            with open(json_definition_file) as json_def:
                form_def = json.load(json_def)
                lyr["formInfo"] = form_def

except FileNotFoundError:
    print(f"No form file for {lyr['title']}")

item_properties = {"text":wm_item_data}
wm_item.update(item_properties=item_properties)

 

Always test the workflow before applying to a live WebMap and make sure to backup or copy to avoid disappointment 😅

All the best,

Glen

~ learn.finaldraftmapping.com