PROBLEM

Unable to perform query on feature layers in ArcGIS Online or Portal for ArcGIS web apps

Last Published: May 30, 2024

Description

Performing queries on feature layers fail when accessed anonymously in ArcGIS Online or Portal for ArcGIS web apps, even if the feature layers, view layers, or web maps are shared publicly. For example, pop-ups and attached images do not display in the web app even though both the layer and the web app are public.

The dashboard below demonstrates the image attached to the related table not displayed when accessed anonymously.

A dashboard accessed in an incognito mode browser

Cause

The web app is using feature layers or view layers created from ArcGIS Survey123, and the item setting for the layers is set to disable any form of query on the layer. When the 'What features can editors see?' setting is set to 'Editors can't see any features, even those they add', the allowAnonymousToQuery parameter for these feature layers is set to false, preventing queries from being performed without signing in to ArcGIS Online or Portal for ArcGIS organizations. This parameter can be found in the feature layer's JSON script in the ArcGIS REST Services Directory.

The image below shows the allowAnonymousToQuery parameter set to false in a feature layer's JSON script in the ArcGIS REST Services Directory.

The allowAnonymousToQuery parameter is false in the JSON script

Solution or Workaround

Configure the layer editing settings

On the Settings tab of the hosted feature layer, in the Feature layer (hosted) section, ensure the following parameters are enabled and save the configurations.

  • For What kind of editing is allowed?, check the Add, Delete, and Update check boxes.
  • For What features can editors see?, check the Editors can see all features check box.
The Feature layer (hosted) section of the feature layer settings.

An additional step is required when a view layer is used in a web app. Update the view layer settings after configuring the source layer settings. On the Settings tab of the view layer, in the Feature layer (hosted, view) section, click Update View. For more information, refer to ArcGIS Online: Edit a hosted feature layer view definition.

The Update View option in the Feature layer (hosted, view) section.

Update the service definition from the ArcGIS REST Services Directory

Set the allowAnonymousToQuery parameter to true in the feature layer JSON script.

  1. Access the feature layer admin endpoint. Refer to How To: Access the REST and admin endpoints of an ArcGIS Online hosted service after the June 2022 update for instructions.
  2. On the admin endpoint in the ArcGIS REST Services Directory window, click Update Definition for the Supported Operations parameter.
The admin endpoint in the ArcGIS REST Services Directory window.
  1. For allowAnonymousToQuery, type true and click Update Service Definition.
The allowAnonymousToQuery parameter is true in the Update Service Definition text box.

The dashboard below demonstrates the query performed on the feature layer as the image attached to the related table is displayed in the pop-up when accessed anonymously.

A dashboard with an image in a pop-up accessed in an incognito mode browser.

Article ID: 000031402

Software:
  • ArcGIS Online
  • Portal for ArcGIS
  • ArcGIS Enterprise 11 1
  • ArcGIS Enterprise 11 3
  • ArcGIS Enterprise 11 2

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options