On this page
The delete records task will delete one or more features to a target layer.
The user must specify the target layer. The layer can be a layer in the web map or an externally referenced layer.
The data script for the delete records task should return a FeatureSet, an array of features, or an array of object ids to be removed.
Example data scripts
Delete features using a FeatureSet
1 2 3 4 5 6 | // Create a subset of features to delete from the layer based on Filter var id = $feature.typeID; var featuresToDelete = Filter($targetlayer, "uniquelandid=@id" ) // Return the FeatureSet of features to delete return featuresToDelete; |
Delete features using an array of features
1 2 3 4 5 | // Select the first feature in the target layer var featureToDelete = first($targetlayer); // Return the array of features, to delete. return [ featureToDelete ]; |
Features used in a delete, must be sourced from the target layer using a FeatureSet query.
Delete features using an array of object ids
1 2 | // Return the array of object ids to delete. return [ 122, 2828 ]; |
Failing the whole operation
1 2 3 4 | // Failing the whole operation return { error: "Cannot delete whilst inspections are in progress." }; |