<?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 Re: Feature Layer Overwrite Error - Data Referring to Another Service in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541915#M14297</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We saw this exact same behavior:&amp;nbsp; we're searching on a title of "MyServiceName" and it was returning the name of "MyServiceName_UAT" (we had both in AGOL), since the "_UAT"-named service was the first element in the returned array.&amp;nbsp;&amp;nbsp;Found &lt;A href="https://developers.arcgis.com/python/guide/accessing-and-creating-content/"&gt;this &lt;/A&gt;very important bit of documentation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;It's important to understand that the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.875em;"&gt;search&lt;/CODE&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mechanism uses many different inputs to find possible matches, ranks them and returns appropriate results. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.875em;"&gt;search&lt;/CODE&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;becomes ideal for human interaction, but&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.875em;"&gt;fuzzy&lt;/CODE&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;when looking for specific records programmatically. The search results are non-deterministic. Using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.875em;"&gt;search&lt;/CODE&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;may not necessarily be the best approach for finding specific items, but more a group of items from which to further filter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;Seems like the only way around this is to loop through the results and look for the exact item name/title, i.e. something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;sdItems = gis.content.search(query="title:{} AND owner: {}".format(my_name, user), item_type="Service Definition")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;if len(sdItems) &amp;gt; 0:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;for item in sdItems:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;if item.title ==&amp;nbsp;my_name:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;sditem = item&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;break&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;else:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;continue&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;else:&amp;nbsp;&amp;nbsp;&amp;nbsp;# assume that the one item found is the one you want&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;sditem = sdItems[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or something like that. (Code above untested)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Feb 2020 01:18:21 GMT</pubDate>
    <dc:creator>deactivated-user-ChrisBeaudett</dc:creator>
    <dc:date>2020-02-05T01:18:21Z</dc:date>
    <item>
      <title>Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541904#M14286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been experiencing the following error for a few months now every time I try to overwrite my feature layer in order to update my Web Mapping Application that was built with the Web App Builder:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"User cant overwrite this service, using this data, as this data is already referring to another service."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My map is set up like this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I uploaded a file geodatabase which created a feature layer.&lt;/LI&gt;&lt;LI&gt;I added the feature layer to a map, created symbology, and saved the layer and map.&lt;/LI&gt;&lt;LI&gt;I then create a Web Mapping Application by using the Web App Builder that pointed to the previously made Web Map and published it.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm unsure of how to update this map. I assumed I could just overwrite the feature layer with the updated file geodatabase, but I get that error each time and I'm not entirely sure what it means. I'm guessing that it can't update the layer while the Web Mapping Application still references it, but if that's the case, then how are you supposed to update the map?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been forced to just create a whole new layer each time and redo all of the symbology. There must be a better way to update a web map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Oct 2015 21:28:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541904#M14286</guid>
      <dc:creator>CodyYates</dc:creator>
      <dc:date>2015-10-07T21:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541905#M14287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Cody,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Did you ever solve this problem? I am having the same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Jun 2017 18:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541905#M14287</guid>
      <dc:creator>OGLEngineering</dc:creator>
      <dc:date>2017-06-01T18:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541906#M14288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe once you create a hosted feature layer in AGOL, a unique ID is generated for that feature layer. It sounds like when you attempt to 'overwrite' the feature layer it is generating a new unique ID for that feature layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not edit the feature layer in AGOL, then your edits will display in you app?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Jun 2017 18:36:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541906#M14288</guid>
      <dc:creator>MichaelMiller2</dc:creator>
      <dc:date>2017-06-01T18:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541907#M14289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to edit the projection of the hosted feature layer. I don't know of a way to edit this through AGOL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Funny thing is that this process worked for one hosted feature layer, but not for another one. They are both in the same map and web app. It's the first time I've seen this error, and there doesn't seem to be any documentation about it.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Jun 2017 18:55:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541907#M14289</guid>
      <dc:creator>OGLEngineering</dc:creator>
      <dc:date>2017-06-01T18:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541908#M14290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get the same error trying to use a script to update. It works fine if I manually use overwrite web layer in Pro. I wonder what Pro is doing to overcome this. I don't know why esri puts tools out there that don't have a way to implement via arcpy. Really annoying.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2017 16:56:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541908#M14290</guid>
      <dc:creator>ScottStopyak</dc:creator>
      <dc:date>2017-09-12T16:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541909#M14291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm getting the same error as you, using the same workflow, from&amp;nbsp;&lt;A class="link-titled" href="https://blogs.esri.com/esri/arcgis/2017/03/14/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/" title="https://blogs.esri.com/esri/arcgis/2017/03/14/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/"&gt;Updating your hosted feature services with ArcGIS Pro and the ArcGIS API for Python | ArcGIS Blog&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Dec 2017 20:56:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541909#M14291</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2017-12-04T20:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541910#M14292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/26031"&gt;Scott Stopyak&lt;/A&gt;‌ I found the issue&amp;nbsp;behind "&lt;SPAN style="background-color: #ffffff;"&gt;"User cant overwrite this service, using this data, as this data is already referring to another service."". From&amp;nbsp;&lt;A href="https://blogs.esri.com/esri/arcgis/2017/03/14/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/" style="color: #2989c5; text-decoration: none;" title="https://blogs.esri.com/esri/arcgis/2017/03/14/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/"&gt;Updating your hosted feature services with ArcGIS Pro and the ArcGIS API for Python | ArcGIS Blog&lt;/A&gt;&amp;nbsp;, the item search is executed with:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Replace that with:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;sdItem = gis.content.search(query="title:"+ sd_fs_name + " AND owner: " + user)[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;The original search string was somehow causing the search to go boolean, which may or may not return the service name you had set with&amp;nbsp;sd_fs_name, because it wasn't restricting the search to the item title. For example, if your service title was "BIG SASQUATCH", using the original search string would return the first item that had "SASQUATCH" any where in the title, tags, summary, or description, in my case, it would always return "SASQUATCH TRAINING".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/python/guide/accessing-and-creating-your-content/#searching-for-content" title="https://developers.arcgis.com/python/guide/accessing-and-creating-your-content/#searching-for-content"&gt;Accessing and creating content | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&amp;nbsp;provided some insight on the correct way to format the search.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Here's how I tested this:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import os, sys&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt; &lt;BR /&gt;sd_fs_name = "SASQUATCH"&lt;BR /&gt;&lt;SPAN&gt;portal = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fwww.arcgis.com" rel="nofollow" target="_blank"&gt;http://www.arcgis.com&lt;/A&gt;&lt;SPAN&gt;" # Can also reference a local portal&lt;/SPAN&gt;&lt;BR /&gt;user = "yabbayabbadoo"&lt;BR /&gt;password = "sasquatch"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;print("Connecting to {}".format(portal))&lt;BR /&gt;gis = GIS(portal, user, password)&lt;/P&gt;&lt;P&gt;print("Searching for SD on AGOL...")&lt;BR /&gt;sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Service Definition")[0]&lt;BR /&gt;print("Found SD: {}, ID: {}".format(sdItem.title, sdItem.id))&lt;/P&gt;&lt;P&gt;print("Search for HFS on AGOL...")&lt;BR /&gt;hfsItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Feature Service")[0]&lt;BR /&gt;print("Found HFS: {}, ID: {}".format(hfsItem.title, hfsItem.id))&lt;/P&gt;&lt;P&gt;print("Search for HFS on AGOL using simple search...")&lt;BR /&gt;sshfsItem = gis.content.search(query="title:"+ sd_fs_name + " AND owner: " + user)[0]&lt;BR /&gt;print("Found ssHFS: {}, ID: {}".format(sshfsItem.title, sshfsItem.id))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Dec 2017 12:32:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541910#M14292</guid>
      <dc:creator>ThomasColson</dc:creator>
      <dc:date>2017-12-05T12:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541911#M14293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Thomas!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Dec 2017 13:31:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541911#M14293</guid>
      <dc:creator>ScottStopyak</dc:creator>
      <dc:date>2017-12-05T13:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541912#M14294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/8888"&gt;Thomas Colson&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;For my use, which may be different to others, when I used your (Thomas) modification I got another error saying the file type needed to be specified. I forget the exact error syntax but that was the gist. I took your mod and added the item_type= at the end. In my case it was a service definition file. The process ran.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I had success with the following &lt;STRONG&gt;tweak&lt;/STRONG&gt; to your code:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;sdItem = gis.content.search(query="title:"+ sd_fs_name + " AND owner: " + user, &lt;STRONG&gt;item_type="insert value here"&lt;/STRONG&gt;)[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;As a side note, my&amp;nbsp;code specifically said&amp;nbsp; item_type="Service Definition"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2018 17:58:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541912#M14294</guid>
      <dc:creator>ConradSchaefer__DOIT_</dc:creator>
      <dc:date>2018-07-11T17:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541913#M14295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We ran into another issue related to this error.&lt;/P&gt;&lt;P&gt;Turns out the gis.content.search portion of the blog post is not formed well if you have similarly named files. We had an older version named ElectedOfficials.sd and a newer version named Elected_Officials.sd. Using the blog post search query &lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;gis.content.search(“{} AND owner:{}”.format(sd_fs_name, user), item_type=”Service Definition”)[0] you take the zeroith index result under the assumption it is the correct object (and possibly the only object returned??). For our search however there were two items returned. The search formed as follows "Elected_Officials.sd AND owner:[edited out]" yielded two results. It returned both ElectedOfficals.sd and Elected_Officials.sd in that order so the zeroth was the wrong one. We revised the query string to be "title:{} AND owner:{}" and it will yield only one result. We have added a check for the length of the query return to avoid future run-ins with this issue should other similarly yet NOT identical file names be located in our account.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;We first caught on to this when we burrowed down into the class dictionaries to look for dependencies. When I transferred the ElectedOfficials.sd out of my accounts ownership it no longer met the blog posts query requirements and the Elected_Officials.sd moved to the zeroith index and exposed the issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;The builtin .__dict__ can be quite useful!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2018 17:52:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541913#M14295</guid>
      <dc:creator>ConradSchaefer__DOIT_</dc:creator>
      <dc:date>2018-08-16T17:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541914#M14296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This error came up after I renamed my file with underscores instead of spaces. Then I changed it back and I still have the error. I broke my app. Unlike other users I specified the owner and title and only came back with one search result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 21:29:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541914#M14296</guid>
      <dc:creator>SteveScott</dc:creator>
      <dc:date>2020-02-04T21:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541915#M14297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We saw this exact same behavior:&amp;nbsp; we're searching on a title of "MyServiceName" and it was returning the name of "MyServiceName_UAT" (we had both in AGOL), since the "_UAT"-named service was the first element in the returned array.&amp;nbsp;&amp;nbsp;Found &lt;A href="https://developers.arcgis.com/python/guide/accessing-and-creating-content/"&gt;this &lt;/A&gt;very important bit of documentation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;It's important to understand that the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.875em;"&gt;search&lt;/CODE&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mechanism uses many different inputs to find possible matches, ranks them and returns appropriate results. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.875em;"&gt;search&lt;/CODE&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;becomes ideal for human interaction, but&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.875em;"&gt;fuzzy&lt;/CODE&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;when looking for specific records programmatically. The search results are non-deterministic. Using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE style="color: #595959; background-color: #f8f8f8; border: 1px solid #efefef; font-size: 0.875em;"&gt;search&lt;/CODE&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;may not necessarily be the best approach for finding specific items, but more a group of items from which to further filter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;Seems like the only way around this is to loop through the results and look for the exact item name/title, i.e. something like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;sdItems = gis.content.search(query="title:{} AND owner: {}".format(my_name, user), item_type="Service Definition")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;if len(sdItems) &amp;gt; 0:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;for item in sdItems:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;if item.title ==&amp;nbsp;my_name:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;sditem = item&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;break&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;else:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;continue&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;else:&amp;nbsp;&amp;nbsp;&amp;nbsp;# assume that the one item found is the one you want&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;sditem = sdItems[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 120px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or something like that. (Code above untested)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2020 01:18:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541915#M14297</guid>
      <dc:creator>deactivated-user-ChrisBeaudett</dc:creator>
      <dc:date>2020-02-05T01:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541916#M14298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my case the problem wasn't with the search results, I was getting the correct service definition item, my problem was that the map item name had changed in the Pro .aprx. Since the target feature service titles no longer matched the update call would fail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/309685/how-to-update-a-hosted-feature-service-on-arcgis-online-using-the-python-api-for"&gt;https://gis.stackexchange.com/questions/309685/how-to-update-a-hosted-feature-service-on-arcgis-online-using-the-python-api-for&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I deleted and republish the feature serive from Pro the thread I found the solution on says you can also change the map name back to the original name. I didn't try this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2020 21:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/541916#M14298</guid>
      <dc:creator>DrewDowling</dc:creator>
      <dc:date>2020-07-23T21:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer Overwrite Error - Data Referring to Another Service</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/1058504#M20846</link>
      <description>&lt;P&gt;Has anyone found any other solutions to this? My issue is definitely not based on getting the incorrect item in my search as I am using a content.get on the item id instead of the search. It also works fine with a manual overwrite from Pro. I have tried changing the layer name when publishing and that doesn't seem to help or hurt the situation.&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 14:01:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/feature-layer-overwrite-error-data-referring-to/m-p/1058504#M20846</guid>
      <dc:creator>StephanieBosits</dc:creator>
      <dc:date>2021-05-17T14:01:22Z</dc:date>
    </item>
  </channel>
</rss>

