I'm hoping to programitcally set a default value of a property. This value will be depend on some business logic and will be different for every node. Is it possible to amend the node properties just after create. I've notice the following handler is hit just after create. But i don't believe the node has been created at this point
Action on node creation
I'm hoping to programitcally set a default value of a property. This value will be depend on some business logic and will be different for every node. Is it possible to amend the node properties just after create. I've notice the following handler is hit just after create. But i don't believe the node has been created at this point
umbraco.interfaces.IAction[] umbraco.BusinessLogic.Actions.IActionHandler.ReturnActions() {
// i want add my business logic here but it seems the node hasn't been created yet.
return new umbraco.interfaces.IAction[] { new umbraco.BusinessLogic.Actions.ActionPublish() };
}
I am aware that i can amend the node on 'umbraco.BusinessLogic.Actions.IActionHandler.Execute' but this is hit on save.
Are you using V4? If so, then you should use the new events instead. Take a look at this article for a sample:
http://umbraco.org/documentation/books/api-cheatsheet/using-applicationbase-to-register-events
You could do something like this (written directly here, so may have syntax errors):
This fires when you create the document. So that is before you save/publish or enter anything into the doc.
Principle is the same if you want to do it every time the document is saved/published. See a list of all events here:
http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events
perfect, sorry i wanted to give you thumbs up and the correct answer credit. Seems you can only do one.
oh, i think it works if you refresh :)
is working on a reply...