I am looking for some advice. I am currently using ArcPro 2.9+ with a branched versioning and am setting up a new workflow. As a first step in our workflow process I need to create a version with a record. I prefer to do this all in one step so that I can programmatically control/manage both version and record info with one user interface. Once a version is created I have found that I can programmatically create a record using the following code which creates a record in the Parcel Fabric records feature class (with no spatial component). Obviously, I will be adding more attributes but am using this as a basic test.
-------------
thisProject = arcpy.mp.ArcGISProject("CURRENT")
Map = thisProject.activeMap
TargetFabric = Map.listLayers("TaxlotsPF")[0]
TargetRecord = Map.listLayers("Records")[0]
cursor = arcpy.da.InsertCursor(TargetRecord, ["Name"])
cursor.insertRow(["DeanTest111"])
----------------
I also found I can create a version using the "CreateVersion" tool. Again, using the tool from a script is important as we want to manage both the version name and the record name following a set of rules and also ensure that improper characters are not used to name a version or a record. I just took the following example from the user documentation but have used the tool successfully in a test environment.
arcpy.CreateVersion_management(inWorkspace, parentVersion, versionName, "PUBLIC")
-----
The "Change Version" tool only seems to apply to specific layers. It does seem to work that I can assign my new record change to a specific version (yay). Can this tool apply to "ALL" layers in my current project? (I will be trying this next - It should be pretty simple to loop through all layers in my current active map )
My question is: Is this a good way to do this or are there better ways? I have been testing a variety of tools, scripts, tasks etc. in a branched version environment for awhile.
Again Our Goal - One user interface that helps the user create both a new version with a new record and changes the version and makes the new record active.