<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Branch Version Change To Default option in ArcGIS Pro 3.0 &amp;amp; Arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/branch-version-change-to-default-option-in-arcgis/m-p/1204642#M67764</link>
    <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per our project requirement we want to build a tool using arcpy to change branch version to default.&lt;/P&gt;&lt;P&gt;Detailed Requirement&lt;/P&gt;&lt;P&gt;We are using BRANCH versioned feature service to perform editing's in ArcGIS Pro 3.0.&lt;/P&gt;&lt;P&gt;After completing the edits, requirement is to change the added feature service in TOC from 'child version' to 'SDE.DEFAULT' version using arcpy&lt;/P&gt;&lt;P&gt;&lt;U&gt;Python code we are trying to use:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject(r"C:\abc_Pro\Project\abc_Aprx.aprx")&lt;/P&gt;&lt;P&gt;m = aprx.listMaps('Map')[0]&lt;/P&gt;&lt;P&gt;for lyr in m.listLayers():&lt;BR /&gt;if (lyr.name == "APPROVED"):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;arcpy.management.ChangeVersion(lyr, "BRANCH", "sde.DEFAULT", None, "INCLUDE")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print(lyr.name)&lt;/P&gt;&lt;P&gt;When we run the above script in "Python Notebook" in ArcGIS Pro, it is working fine.&lt;/P&gt;&lt;P&gt;When we run the same from python script (ex: abc.py), script executing with out errors but services are not changing to "DEFAULT" version.&lt;/P&gt;&lt;P&gt;Anything we are missing in this. Appreciate help on this. Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2022 17:23:30 GMT</pubDate>
    <dc:creator>SU00861536</dc:creator>
    <dc:date>2022-08-19T17:23:30Z</dc:date>
    <item>
      <title>Branch Version Change To Default option in ArcGIS Pro 3.0 &amp; Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/branch-version-change-to-default-option-in-arcgis/m-p/1204642#M67764</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per our project requirement we want to build a tool using arcpy to change branch version to default.&lt;/P&gt;&lt;P&gt;Detailed Requirement&lt;/P&gt;&lt;P&gt;We are using BRANCH versioned feature service to perform editing's in ArcGIS Pro 3.0.&lt;/P&gt;&lt;P&gt;After completing the edits, requirement is to change the added feature service in TOC from 'child version' to 'SDE.DEFAULT' version using arcpy&lt;/P&gt;&lt;P&gt;&lt;U&gt;Python code we are trying to use:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject(r"C:\abc_Pro\Project\abc_Aprx.aprx")&lt;/P&gt;&lt;P&gt;m = aprx.listMaps('Map')[0]&lt;/P&gt;&lt;P&gt;for lyr in m.listLayers():&lt;BR /&gt;if (lyr.name == "APPROVED"):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;arcpy.management.ChangeVersion(lyr, "BRANCH", "sde.DEFAULT", None, "INCLUDE")&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;print(lyr.name)&lt;/P&gt;&lt;P&gt;When we run the above script in "Python Notebook" in ArcGIS Pro, it is working fine.&lt;/P&gt;&lt;P&gt;When we run the same from python script (ex: abc.py), script executing with out errors but services are not changing to "DEFAULT" version.&lt;/P&gt;&lt;P&gt;Anything we are missing in this. Appreciate help on this. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 17:23:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/branch-version-change-to-default-option-in-arcgis/m-p/1204642#M67764</guid>
      <dc:creator>SU00861536</dc:creator>
      <dc:date>2022-08-19T17:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Branch Version Change To Default option in ArcGIS Pro 3.0 &amp; Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/branch-version-change-to-default-option-in-arcgis/m-p/1207321#M67765</link>
      <description>&lt;P&gt;This area is for the Python API rather than ArcPy, but will try to address your question. I would start by adding some debugging information to your script, and checking what `&lt;SPAN&gt;m.listLayers()` shows when running in standalone Python. It is possible that the&amp;nbsp;&lt;/SPAN&gt;aprx hasn't been saved at the point in execution? &amp;nbsp;If the aprx exposes the right information, it may be that the GDB model is different in this case, but that seems less likely.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Cheers, Shaun&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 17:26:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/branch-version-change-to-default-option-in-arcgis/m-p/1207321#M67765</guid>
      <dc:creator>ShaunWalbridge</dc:creator>
      <dc:date>2022-08-29T17:26:56Z</dc:date>
    </item>
  </channel>
</rss>

