Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created April 7, 2017 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/3ab4b7245e2fc8477471cbe2160f31ac to your computer and use it in GitHub Desktop.
Save dcomartin/3ab4b7245e2fc8477471cbe2160f31ac to your computer and use it in GitHub Desktop.
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