Ive installed Umbraco 7 using VS + nuget and captured ContentService.Created, ContentService.Creating & ContentService.Publishing. It seems that the two create related Events are never thrown as none of my breakpoints are hit. In the publicing event my breakpoints are hit.
I dont know if its a bug or just changed behavior as in U 7 we dont create it before we save it I guess Before - we actually named and created a node before editing and then saving.
If thats the case - how do we add inital values to fields from events?
both the creating and created events will be obsoleted and should not be used, they are only there for legacy purposes and only fire when using the ContentService.CreateContent to instantiate a new IContent item which is not a mandatory way to create content so it is inconsistent at best (i.e. If a package I release does not use this method to create content and instead i just do: var mycontent = new Content(), the event will not fire)
Use the Saving event instead, you can determine there if the IContent instance is new.
I see the problem. Thx. Related to that - does Umbraco 7 provide a frontend solution to this? A angularjs event that fires onload that we can hook into in a nonhack way?
Currently no it doesn't. we will provide a c# API that allows you to modify the model created by the controllers before they are being sent to the view but that will be in 7.1. That will allow you to do all sorts of crazy stuff like even adding custom tabs/properties that don't actually exist on the document type (whilst still being validated on the server side post ). With that we can create an angular event - which you could modify model values but you won't be able to add/remove entire properties that way since it won't validate on the server side.
Umbraco 7 events - how to catch the creating event
Hi there,
I'm trying to modify some document propeties when creating the document but I fail.
I've created the following:
What happends is nothing :-)
I cant debug umbraco7 as I havent managed to get it to run in Visual Studio yet.
Any obvious misses?
best
Jesper
ps. catching the Publishing event and modifying content using the same approach works fine.
Comment author was deleted
Hmm think the creating event might be to soon, try moving to created
Hi Tim
I tried:
Same same .. nothing is saved. I havent even tried to call save after as I cant imagine but ?
Ive installed Umbraco 7 using VS + nuget and captured ContentService.Created, ContentService.Creating & ContentService.Publishing. It seems that the two create related Events are never thrown as none of my breakpoints are hit. In the publicing event my breakpoints are hit.
I dont know if its a bug or just changed behavior as in U 7 we dont create it before we save it I guess Before - we actually named and created a node before editing and then saving.
If thats the case - how do we add inital values to fields from events?
best
Jesper
Comment author was deleted
SO looks like a bug, thanks for putting it on the issue tracker http://issues.umbraco.org/issue/U4-3695
I've replied on the tracker: http://issues.umbraco.org/issue/U4-3695
both the creating and created events will be obsoleted and should not be used, they are only there for legacy purposes and only fire when using the ContentService.CreateContent to instantiate a new IContent item which is not a mandatory way to create content so it is inconsistent at best (i.e. If a package I release does not use this method to create content and instead i just do: var mycontent = new Content(), the event will not fire)
Use the Saving event instead, you can determine there if the IContent instance is new.
I see the problem. Thx.
Related to that - does Umbraco 7 provide a frontend solution to this? A angularjs event that fires onload that we can hook into in a nonhack way?
Currently no it doesn't. we will provide a c# API that allows you to modify the model created by the controllers before they are being sent to the view but that will be in 7.1. That will allow you to do all sorts of crazy stuff like even adding custom tabs/properties that don't actually exist on the document type (whilst still being validated on the server side post ). With that we can create an angular event - which you could modify model values but you won't be able to add/remove entire properties that way since it won't validate on the server side.
Good stuff. Thx
Any updates on the API you will provide in 7.1, we are at 7.2.1 and I'm working with these now and wondering if it's in 7.2.1
Hi, you can track the two task items required for this here:
http://issues.umbraco.org/issue/U4-2670 http://issues.umbraco.org/issue/U4-2671
I'm running the below code which works just fine. Maybe it'll help you!
Wow - that was an old topic. Thanks for update. Looks great. I'll try it out.
best
Jesper
is working on a reply...