Bug ID Number |
BUG-000114017 |
Submitted | May 16, 2018 |
Last Modified | November 21, 2024 |
Applies to | ArcGIS Pro |
Version found | 2.1.2 |
Operating System | Windows OS |
Status | Known Limit
After review by the development team, it has been determined that this issue is related to a known limitation with the software that lies outside of Esri's control. The issue's Additional Information section may contain further explanation.
|
Additional Information
In ArcGIS Pro, use derived parameters in the script tool to get the layer to update its version. Add a new derived output parameter to the script tool of datatype feature layer, and update the script to use the following code, and the layer that is added is correctly switched to the new version.
import arcpy
from arcpy import env
env.overwriteOutput = True
database = arcpy.GetParameterAsText(0)
featureClass = arcpy.GetParameterAsText(1)
name = arcpy.GetParameterAsText(2)
dbaseUser = arcpy.GetParameterAsText(3)
#create version in database
arcpy.CreateVersion_management(database, "sde.DEFAULT", name, "PUBLIC")
arcpy.AddMessage("Created version")
# create featue layers
layer = arcpy.MakeFeatureLayer_management(featureClass, "NewLayer").getOutput(0)
arcpy.AddMessage("Created Feature Layer")
#change version of database for feature layer
arcpy.ChangeVersion_management("NewLayer", "TRANSACTIONAL", dbaseUser + "." + name)
arcpy.AddMessage("Changed version")
arcpy.SetParameterAsText(4, "NewLayer")
Workaround
The Change Version tool does work in ArcMap from a script, so it can be utilized there.
Saving the created layer in the script to a file respects the version change. When that saved layer is brought into a map in ArcGIS Pro, the version is changed successfully. This workaround cannot be used for table views.
Steps to Reproduce