Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created April 7, 2017 01:41
Embed
What would you like to do?
function sp_demo(customers){
var context = getContext();
var collection = context.getCollection();
var collectionLink = collection.getSelfLink();
for (var x in customers) {
if (!customers[x].Name) throw "Invalid Customer Name";
collection.createDocument(collectionLink, customers[x]);
}
var response = context.getResponse();
response.setBody(customers.length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment