Dynamically change name of content item on creation in back office.
Hi Guys, im new to Umbraco since 2024 and we are using version 13.
I need to hook into some kind of event handler when content is created. I've found some examples for previous versions of Umbraco but the same namespaces/classes do not exist in v13.
Basically I want to change the name of the content item dynamically when created in the back office. I want to add a property value to the name of the content item.
Example I have a doc type with a property called "group".
I want the name of the name of the content item created to include the "group" value that's inputted by the user.
I hope that clear and I welcome myself to this community.
This is broadcast 'just before' the content is loaded in the backoffice ready to be edited...
... This works well if you want to suggest a convention, repopulate a field, set article date to be today's date... Things like that, but ultimately the editor can choose to change your defaults and save and publish what they like..
This notification is broadcast when the editor presses save and publish on a page they have edited...
You have access to what they have entered for each field and can write code to check and augment these values before it is saved and published... Here your code can cancel the saving event and send a message temporarily back to the editor... Or can just add:update values eg, set an article date to be today's date if it has been left blank or read the parent group node and prep end it to the name of the node being saved!
Anyway hopefully that's enough of a steer to get you on the right track!
I get this error a lot because of trying to create nested content document types.
Can you shed some light on how to fix this issue in version 13. See below.
Dynamically change name of content item on creation in back office.
Hi Guys, im new to Umbraco since 2024 and we are using version 13.
I need to hook into some kind of event handler when content is created. I've found some examples for previous versions of Umbraco but the same namespaces/classes do not exist in v13.
Basically I want to change the name of the content item dynamically when created in the back office. I want to add a property value to the name of the content item.
Example I have a doc type with a property called "group".
I want the name of the name of the content item created to include the "group" value that's inputted by the user.
I hope that clear and I welcome myself to this community.
Thanks all
Hi Lyle
Notifications! Is the new name for events!!
https://docs.umbraco.com/umbraco-cms/reference/notifications
There are two notifications that get broadcast that might be handy for what you are trying to achieve....
1) firstly the SendingContentNotification
https://docs.umbraco.com/umbraco-cms/reference/notifications/editormodel-notifications
This is broadcast 'just before' the content is loaded in the backoffice ready to be edited... ... This works well if you want to suggest a convention, repopulate a field, set article date to be today's date... Things like that, but ultimately the editor can choose to change your defaults and save and publish what they like..
2) secondly, the Content Saving Notification
https://docs.umbraco.com/umbraco-cms/reference/notifications/contentservice-notifications
This notification is broadcast when the editor presses save and publish on a page they have edited...
You have access to what they have entered for each field and can write code to check and augment these values before it is saved and published... Here your code can cancel the saving event and send a message temporarily back to the editor... Or can just add:update values eg, set an article date to be today's date if it has been left blank or read the parent group node and prep end it to the name of the node being saved!
Anyway hopefully that's enough of a steer to get you on the right track!
Regards
Marc
Thanks Marc, I managed to implement the ContentSavingNotification.
Hi again Marc,
I get this error a lot because of trying to create nested content document types. Can you shed some light on how to fix this issue in version 13. See below.
Your help would be really appreciated.
is working on a reply...