I have been trying to figure out how I can set a default value to a field in ArcMap. I see there is a tool called Assign Default to field but that is applied to the entire dataset. I would like the default to apply to the current ArcMap session only. In the Create Features window you can right click a layer and set a default there to get the behavior I would like but am trying to accomplish this for multiple layers in the TOC using python.
This is what I have been trying, starting with one layer first, but get an error "The attribute 'defaultValue' is not supported on this instance of Field" I can print the defaultValue however.
feature_class = "Roads"
fields = arcpy.ListFields(feature_class)
for field in fields:
if field.name == "Project_Name":
field.defaultValue = "Test_Project"
Forgive me if I am making an obvious mistake. I am still a beginner. Thanks for any help!