We use SDL Web 8.5 Our filename is always index, so our client is asking to automate that. How we can prepopulate the filename when creating a Page?
In the absence of any details regarding what you've tried - I'll keep my advice general too...
extension points for Tridion.
Specifically, you should read up on
Event System and
This will allow you to interact with the details of the Page at the point of saving (or other 'events' if desired); you could thus
- validate that the SG the Page is being saved in doesn't contain an index page already
- if it does the CMS will throw an exception if you try to save anyway as you can't have two filenames the same in a single SG
- if it does not then you could default to 'index' and even fail the save if the name isn't 'index' or force the filename to index and save
Personally, I'd be wary of just imposing technical conventions on the editor without properly informing them and would suggest that this would be fall-back from the next option - however, Nuno has a good point about keeping the implementation simple - if defaulting/forcing to 'index' is a strict business requirement then the event system could, at the very least, pre-populate and let the user override if required
You can interact with Page through GUI Extensions and in your case I'd suggest that you could follow some sort of process that
- checks (through the core service if the folder the current page is being created in contains an index page already).
- If it does - they won't be able to save with the same name anyway but I guess the question is whether you want to allow them to still save a none 'index' page in a SG or not
- assuming it doesn't, you could pre-populate the relevant fields
The challenge here will likely be the coding required to access specific fields in the GUI - as these may change through upgrades (less likely, I'd suggest, in minor updates) - consequently, I'm sure you will be avidly Googling the term "Tridion FieldBuilder" in no time.
You can use the same approach I describe here: http://www.tridiondeveloper.com/inheriting-metadata-on-organizational-items
The example above was about changing data on a newly created Structure Group, but the same principle can apply to a Page for sure. Then you could change the value of Page.FileName (or whatever is the exact property).