The add records task will write 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 add records task should return a feature or an array of features.

Example data scripts

Returning a single feature

var geom = ...
 
return Feature(geom, {
    "attr1": "some attribute",
    "attr2", "another attribute"
})

Returning an array of features

var feat1 = Feature(geom, {
    "attr1": "some attribute",
    "attr2", "another attribute"
})
var feat2 = ...
 
return [feat1, feat2];

Failing the whole operation

return {
    error: "Cannot Add as items already exist"
};