Reputation: 2415
When a user saves a given doc type I want to check a property value, if it has changed from the original value I want to perform some action.
Any Ideas?
I know how to use the events, what I need help with is the syntax... heres what I mean.
void ContentService_Saving(IContentService sender, Umbraco.Core.Events.SaveEventArgs<IContent> e)
{
foreach (var myNode in e.SavedEntities.Where(x => x.HasProperty("propertyName")))
{
//if (myNode.GetPropertyValue("propertyName").hasChanged)
// then
//bla bla bla
}
}
Also is there a version of this method that is a single IContent object rather than a list, In previous versions was this not the case?
Upvotes: 1
Views: 513
Reputation: 2415
This is the answer I was looking for..................... why is there no documentation on this method :-/
void ContentService_Saving(IContentService sender, Umbraco.Core.Events.SaveEventArgs<IContent> e) {
foreach (var myNode in e.SavedEntities.Where(x => x.HasProperty("myproperty")))
{
if (myNode.IsPropertyDirty("packageStatus"))
{
//perform action
}
}
Upvotes: 2
Reputation: 185
You most likely want one of the following events:
See the link below for a list and description of all Umbraco Document Events: https://our.umbraco.org/documentation/Reference/Events/Document-Events
Once you have the correct one, implement as per the tutorial on the link provided above by @Chaitanya Gadkari
Any issues. Update the post.
Regards
Upvotes: 0