You are using a browser that is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. For more information please see the System Requirements.
Skip To ContentArcGIS for DevelopersSign In Dashboard

Unsupported browser

You are using a browser that is not supported. JavaScript API works on the latest versions of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. Use one of these browsers and provide your feedback through GeoNet, the Esri Community.

  • {}
  • Firefox
  • Safari
  • undefined

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to use FeatureLayer.applyEdits() to create new features, update attributes of existing features or delete existing features. This sample uses the FeatureTemplates widget to display templates from the editable feature layer. The widget listens for an end user to select a specific template in the widget. Its select event is fired and the resulting template information is returned. This is used in creating new features.

In addition to the FeatureTemplates widget, this sample also uses the FeatureForm widget to update attributes of new or existing features.

In this sample, the applyEdits function is called when a user either:

  • Clicks to create a new feature.
  • Selects a feature on the view and updates its attributes.
  • Selects a feature on the view and deletes it.
// Call FeatureLayer.applyEdits() with specified params.
function applyEdits(params) { = "none"; = "none";

    .then(function(editsResult) {
      // Get the objectId of the newly added feature.
      // Call selectFeature function to highlight the new feature.
      if (editsResult.addFeatureResults.length > 0) {
        const objectId = editsResult.addFeatureResults[0].objectId;
    .catch(function(error) {
      console.error("[ applyEdits ] FAILURE: ", error.code,, error.message);
      console.log("error = ", error);

FeatureLayer.applyEdits() resolves to an object containing edit results. If the edit failed, the edit result includes an error.

Sample search results