I found out that in the ContentService_Publishing you can compare current value and old one for example:
private void ContentService_Publishing(PublishEventArgs<IContent> args, ApplicationContext applicationContext)
{
var contentService = applicationContext.Services.ContentService;
foreach (var item in args.PublishedEntities)
{
var name = item.Name;
var id = item.Id;
var oldName = contentService.GetById(id).Name;
if (name != oldName)
{
//do something
}
}
}
Perform Action When property changes - Umbraco Events
When a user saves a given doc type I want to check a proprty value, if it has changed from the original value I want to perform some action.
Any Ideas?
Thanks in advance.
Someone must know how to do this?
Hi Ayo,
I guess you can use an event for this - if you have access to Umbraco.TV, there's a series of videos explaining how to do something like that:
Umbraco.TV Developer/Events
Hope that helps,
/Chriztian
Hi Chriztian....
I know how to use the events, what I need help with is the santax... heres what I mean.
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?
Thanks
I found this method
IContent.IsPropertyDirty() can't find any documentation on it though... any ideas?
This is the answer I was looking for..................... why is there no documentation on this method :-/
I found out that in the ContentService_Publishing you can compare current value and old one for example:
And register your method here:
is working on a reply...