Change default split policy on new domains?

5450
25
02-06-2020 08:22 AM
AnnaRoyar1
New Contributor III

Hello!

I am having to set up a bunch of new domains a day for the foreseeable future. Is there a way to have the split policy in domains automatically go to "duplicate" instead of "default" in all new domains. We NEVER need the "default" option and it is very easy to miss that step when setting up multiple things per day.

25 Replies
LukeGilner1
Occasional Contributor

Thanks for looking into this Lindsay.  I was hoping I was doing it wrong!  I'm surprised there are not more people screaming about not being able to update the definitions in the admin services.

Overwriting all my services would definitely not be ideal.  I might just have to revert back to Pro 2.8 just so I can use my split tool correctly, until they fix things.  I'll try to follow up with ESRI about the bug that didn't really get fixed.

LindsayRaabe_FPCWA
Occasional Contributor III

Idea posted here: Update "Alter Domain (Data Management)" tool to up... - Esri Community

Lindsay Raabe
GIS Officer
Forest Products Commission WA
0 Kudos
Cebrown2206
New Contributor

I'm not sure if there's an answer to changing the default settings...but I run a pretty standard script to do this whenever I start a new project and need to make edits to data. You could employ the same script and schedule it to run daily to update all the domains you create. 

Hopefully this helps.

# Identify all domains present within the gdb and create an object list
domainList = arcpy.da.ListDomains(inputGDB)

# Update the split policy for each domain within a loop
for domain in domainList:
# Identify the domain name from the domain object list
domainName = domain.name

# Update the split policy to 'Duplicate' for the domain
arcpy.management.AlterDomain(inputGDB, domainName, split_policy='DUPLICATE')

 

0 Kudos
LindsayRaabe_FPCWA
Occasional Contributor III

Is your script running on local feature classes or feature services in ArcGIS Online? I'd love to find a way to manage ArcGIS Online domains from centralised lists. 

Lindsay Raabe
GIS Officer
Forest Products Commission WA
0 Kudos
LukeGilner1
Occasional Contributor

@LindsayRaabe_FPCWA - I have figured out how to update definitions through the admin services in AGOL!  Here is the general workflow:

1. Go to your item page of the desired layer.

2. Scroll down to the URL and click View.

LukeGilner1_0-1667399255879.png

3. In the ArcGIS Rest Services Directory, click on Admin on the top right.

LukeGilner1_1-1667399330643.png

4. Click on the layer name.

LukeGilner1_2-1667399417024.png

These next few steps are from LindsayRaabe's post here: Re: Splitting tool wipes values from AGOL feature ... - Esri Community

5. Scroll to the bottom of the page and select the "Update Definition" option

LukeGilner1_4-1667399689199.png

6. Clear the lastEditDate value (replace the value with "")

LukeGilner1_5-1667399689214.png

7. Scroll down to the fields list

LukeGilner1_6-1667399689472.png

8. Update any field domains where domain is NOT null with the below line of text:

        "splitPolicy" : "esriSPTDuplicate",

 

LukeGilner1_7-1667399689357.png

 

 Updated JSON below:

LukeGilner1_8-1667399689217.png

 

9. When finished, click the Update Layer Definition button.  You should then say the layer was updated.

LukeGilner1_9-1667399844017.png

 

LindsayRaabe_FPCWA
Occasional Contributor III

I'll have to give this another crack if I can find a feature service that still has the old settings. I think I did a mass run of updates when I had this working the first time so might not have any left. Suppose I could always try on a test dataset and see what happens. Good to know that it wasn't all in vein though!

Lindsay Raabe
GIS Officer
Forest Products Commission WA
0 Kudos