Unable to update feature service layer definition

13709
26
Jump to solution
03-13-2018 08:12 AM
AdrianWelsh
MVP Honored Contributor

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:

  1. Change the lastEditDate key value by replacing the string of numbers, which indicates the last edit date, to double quotation marks with no content quoted between them (“ “).

          Replace the lastEditDate key value

  1. Click Update Layer Definition to save the changes.

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.

1 Solution

Accepted Solutions
KhaledHassen
Esri Contributor

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

View solution in original post

26 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Adrian,

If you have a space between the quotes, try removing this so that you just have "lastEditDate" : ""

0 Kudos
AdrianWelsh
MVP Honored Contributor

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.
KellyGerrow
Esri Frequent Contributor

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

0 Kudos
AdrianWelsh
MVP Honored Contributor

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.

0 Kudos
MichaelVolz
Esteemed Contributor

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?

0 Kudos
larrycamp
New Contributor III

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

0 Kudos
AdrianWelsh
MVP Honored Contributor

No, sorry. I just kind of had to live with it. I did not find success in making this work.

0 Kudos
CatherineHeindel
New Contributor II

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 

0 Kudos
CatherineHeindel
New Contributor II

Sorry everyone, but removing the data from the hosted service did not make a difference for me atleast

0 Kudos