Creating a default document name on creation

I’m in the process of updating a website from V11 to V18, so effectively it’s a rebuild of the site as it’s about 5 or 6 years old and due a rewrite anyway. It’s for my football club and obviously one of the document types is a fixture type.

On the V11 site, I was able to generate a default name of ‘TBC’ for this document using INotificationHandler handler and then when the fixture document is saved I would rename it as Home Team + Away Team + Fixture Date.

I would like to do the same in the V18 site and you cannot save a document with no name assigned to it, so the name creation procedure never fires.

I cannot find any handlers relating to content creation to use with a INotificationHandler class. Can anyone point me in the right direction or give me some pointers.

For reference, the old code was as follows, and worked really well…

 public class FixtureNotificationHandler : INotificationHandler<SendingContentNotification>
  {
      public void Handle(SendingContentNotification notification)
      {
          if (notification.Content.ContentTypeAlias == Fixture.ModelTypeAlias)
          {
              foreach (var v in notification.Content.Variants)
              {
                  if (v.State == ContentSavedState.NotCreated)
                      v.Name = "TBC";
              }
          }

Cheers in advance

Iain

Maybe this can help you:

Cheers Luuk. I actually managed to achieve what I require using the Document Blueprint function baked into the back end of Umbraco. I can actually set the time property of the game with this as well. Just need to train the user to select the New Fixture blueprint instead of the Blank one, but as they insist on just dumping all their media into one folder instead of the carefully created media folder structures I created, I’m not hopeful :slight_smile:

Now I just need to figure out what to use instead of AngularJS for my front end JS stuff - it’s been about 5 years since I last did any of this as I’m now retired and this is just ‘for fun’…