I followed the directions here:
Updating Hosted Feature Services in ArcGIS Online | ArcGIS Blog
to update a hosted feature service in AGOL.
But, I came across this error:
Invalid definition for 'LastEditDate'. Invalid definition for ESRI.ArcGIS.SDS.Metadata.EditingInfo
So, I found this article describing a workaround:
Error: Unable to update feature service layer definition. Invalid definition for 'lastEditDate'
I did what was described in the article:
But, the feature service did not update. It reverted back to the last state.
Has anyone come across this issue? Is there an actual workaround or am I just stuck with what I have?
thanks.
Solved! Go to Solution.
Default value or field size cannot be changed once you add the field. It is defined only when you create the field. Only field visibility, alias, domain can be changed using the layer updateDefinition admin API. You can however add a new field with the desired property including default value/size and then use the layer Calculate API to assign the new field to the old field and delete the old field.
Also you do not need to set any value for lastEditDate or even add to the definition you need to change. The only accepted value for lastEditDate is null which would update the lastEditDate of the layer to the current date.
"lastEditDate" : null.
Khaled
Hi Adrian,
If you have a space between the quotes, try removing this so that you just have "lastEditDate" : ""
Hi Jake,
I wish that worked! It sounded promising.
Here's the thing though. Whenever I make the update and switch the dropdown to JSON from HTML
, I get this message:
{
"success" : true
}
But, when I go back into the layer, it reverts back to the same values as before:
"editingInfo" : {
"lastEditDate" : 1520957077909
},
When I keep it at HTML in the dropdown and update it, it says: "Updated Feature Service Layer" Even though it did not update the layer.
Hey Adrian,
What specific parameter are you updating in the service definition? I'd suggest only including the content of the service definition that you want to change.
-Kelly
Hi Kelly,
I am trying to change the default value of an attribute from null to a number.
Right now it says:
"defaultValue" : null
and I'm trying to change it to
"defaultValue" : 3
It's a numeric field ("type" : "esriFieldTypeInteger", ) and I've tried with and without quotes but it won't let me change the default value.
My field does have a domain associated with it (with values 1 through 10 as options). I wonder if that is the issue.
Let me know if I can provide more information.
Jake:
Have you ever been successful in making these types of changes to hosted feature service in AGOL? If so, is it true that the data needs to be removed from the feature service in order for the changes to be successfully implemented?
Any luck with this? I'm trying to do similar.
Trying to change this value to "false"
"nullable" : true,
I tried the EditDate with " " and ""
Each time I click Update Layer Definition, it reverts back to what it was.
If I change it to JSON, I get - "success" : true
But nothing changed.
If I leave it as HTML, nothing changes
No, sorry. I just kind of had to live with it. I did not find success in making this work.
I may have a found a solution, but have not had a chance to try it yet. According to the link below, the hosted service you try to update might be need to be empty to successfully update. I have the same problem everyone here is having and I have data in my hosted feature service. I will have a chance to try this on Monday, July 16,2018 . I will post my results if no else try this before me.
Update Hosted ArcGIS Feature Service Schema Issue - Geographic Information Systems Stack Exchange
Sorry everyone, but removing the data from the hosted service did not make a difference for me atleast