-
-
Save islaytitans/356c7a342fef40e2b71d to your computer and use it in GitHub Desktop.
Sitecore Hackathon UpdateItem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UpdateItem: function () { | |
var itemService = new entityService({ | |
url: "/sitecore/api/ssc/DevToolKit-Controllers/SitecoreItem" | |
}); | |
var querystring = this.GetQueryString(); | |
var itemid = querystring["itemid"]; | |
var message = this.messagePanel; | |
var fieldsToReset = this.GetItemsToReset(); | |
var result = itemService.fetchEntity(itemid).execute().then(function (item) { | |
for (var i = 0; i < item.Fields.underlying.length; i++) { | |
var field = item.Fields.underlying[i]; | |
if ($.inArray(field.Name, fieldsToReset) != -1) { | |
field.RevertToStandardValue = true; | |
} | |
} | |
item.save().then(function (savedItem) { | |
message.addMessage("notification", { text: "Item updated successfully", actions: [], closable: true, temporary: true }); | |
}).done(this.GetFields()); | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment