I am trying to set one of my fields to default to the name of the page item created. The field is for breadcrumb title, so it logically makes sense to default this to the page name.
I've tried overriding SetDefaultValues on my Page model, but it seems that this function is called before the user is prompted for the page name.
Is this possible in episerver?
Previously to do this I have needed to hook up on the ContentCreated event (or if it was ContentCreating, unfortunately I don't remember).
Unless in your view model you create a fallback so if the Breadcrumb does not have a value, use the Page Name instead.
Given that you already have the value for PageName that breadcrumb name should fallback too, I wouldn't write the same value to the database, but rather do what Alf proposed. When getting the breadcrumb, have something like BreadcrumbName ?? PageName.
If it was more complex than that, if you had some difficult logic to choose the BreadcrumbName, Creating or Publishing would do the work (since in these events, the content is writable). However, "BreadcrumbName ?? PageName" will hardly give you any performance reason to do that.
Thanks! This makes sense!