I have been trying, unsuccessfully to change the title of a previously published hosted feature layer in AGOL getting updated by the following method Updating your hosted feature services with ArcGIS Pro and the ArcGIS API for Python
I have an .aprx that gets used to update open data content, collaborated via AGOL. This .aprx contains feature layers which get used to create and stage service definition files which will then update the .sd files associated with the hosted feature layers. Once a sd file is updated, it gets published to push the changes to the hosted feature layer.
I would like to be able to change the tile of the hosted feature layer and upstream feature layer in the .aprx to update the name of this item. I would like for this update to happen without the item ID of the downstream item in AGOL changing and without having to store a lookup table for the old-new name in my Python script (i.e. I want the change to happen permanently inside the process).
What I've tried (unsucessfully):
1) Updating the feature layer name in TOC, associated .sd and hosted feature layer names in AGOL. This led to the following error in Python during the sdItem.publish(overwrite = True) command:
"RuntimeError: User cant overwrite this service, using this data, as this data is already referring to another service."
I interpret this as the TOC name creates a service draft that wants to publish a new item using the previous .sd but since a pre-existing item is already getting updated by this .sd. The solution would be to delete the pre-existing service hosted feature layer....but that would not allow us to keep its ID.
2) Using the overwrite web layer geoprocessing tool directly on the hosted feature layer with the updated feature layer name. This simply failed with the message: "Failed.View log" (and a link to the log without much information)
I would like to know if there is a way to permanently change the title of a hosted feature layer in the scripting update pipeline describe in the arcgis blog (link above) while keeping the hosted feature layer item ID?
Any help would be great!