Select to view content in your preferred language

How to use the Update Definition operation on a hosted layer view in AGOL

3783
13
Jump to solution
05-17-2018 12:11 PM
Trippetoe
Occasional Contributor III

I am trying to use the Update Definition operation on a hosted feature layer view through the Admin view of the REST endpoint of the feature service.  The change i am trying to make is setting some default values in the 'templates' element.  However, regardless of the changes i try to make to the definition, i am getting the following error message:

Invalid definition for 'DefinitionQuery'.
Invalid definition for System.String

Even for the simplest change of setting "lastEditDate" : " ", I get the error message.  I am the owner of the view.

The definition query (as generated by AGOL when creating the view) looks like this:

{

...

"viewDefinitionQuery" : "(IsActive = 'Yes') AND (CaseType = 'Report') AND (ReportStatus = 'Received')",
"definitionQuery" : "(IsActive = 'Yes') AND (CaseType = 'Report') AND (ReportStatus = 'Received')"

...

}

Any thoughts on what's going on?

13 Replies
ArmstKP
Regular Contributor

This bug still exists as of today.

ChristopherCounsell
MVP Regular Contributor

Can you contact tech support? They closed this bug as non-reproducible. I feel like you and I and others hit this page and assume it's a bug but no one contacting support.

The issue is reproducible for my on the layer definition (i.e. featureserver/0, /1, /2 etc) but it looks like it's not reproducible on the parent service (featureserver/). So a good workaround may be to update the service definition. Either way would be good if you can touch base with support so we can have this issue properly reognized if it's still a thing.

0 Kudos
ChristopherCounsell
MVP Regular Contributor

BUG-000114175 has been closed as 'non-reproducible'.

BUG-000155365 has been opened.

The error does not occur for the 'update service definition', i.e. when you do it at the root layer level. 

The error does occur for the 'update layer definition', i.e. when you go into one of the sublayers of the service and try to update there.

Esri had closed off this issue however long ago but it's now been reopened as BUG-000155365. Please contact support and attach yourself to this issue if you continue to encounter it.

I believe it should be possible to update the sublayer definitions through the service definition - we should be able to workaround the error this way instead of having to remove the definition query.

@ArmstKP FYI

 

fklotz
by
Occasional Contributor

BUG-000155365 is closed with a status of 'As Designed'.
Some folks don't have access to bug pages, so here is the additional information from that bug:

When updating a layer definition from REST, it is recommended to only include the part of the definition that is being updated. Including the entire definition may cause the update definition to fail. The "definitionQuery" cannot be updated by updating the layer definition. However, you can update the "viewDefinitionQuery" without including the rest of the layer definition including the "definitionQuery".

What this means is that instead of including the View's complete layer definition in the 'updateDefinition' REST end point, you only need to include the relevant parts.  To update a view definition, you only need to include the viewDefinitionQuery:

{
    "viewDefinitionQuery" : "CreationDate > timestamp '2024-01-02 05:59:59'"
}

Submitting that will update the 'viewDefinitionQuery' and Esri will update the 'definitionQuery'.

Farley
0 Kudos