<p>I think you'll need to implement this with the <code>Elements::EVENT_AFTER_SAVE_ELEMENT</code> event and keep a record of the number.</p>
<p>If it doesn't need to be sequential 1,2,3 you could use a dynamic title and use {{object.sourceId}} which would be the entry id which will always increment</p>

CC BY-SA 4.0
2020-06-22T11:14:01.037Z
Yeah, this. I wondered about using something like {craft.entries.section('pages')|length} in the Title Format field, but that would update the number to the total length every time you updated the entry. You may still run into problems with the user being able to change the number when they edit the page.
darylknight
CC BY-SA 4.0
2020-06-22T10:52:14.907Z
2020-06-23T12:15:57.183Z
2020-06-23T12:15:57.183Z
Leevi Graham
<p>I have a channel where I need each entry's Title include a sequential number, like this: 10003 - Entry Title</p>
<p>Is there a way to prepend a sequential number to the entry title?</p>

<entry><titles>
Use sequential numbers for entry title
# Use sequential numbers for entry title

(Asked by: username_0 on 2020-06-22)

I have a channel where I need each entry's Title include a sequential number, like this: 10003 - Entry Title

Is there a way to prepend a sequential number to the entry title?

**Tags:** entry, titles

---

## 1 answers

### Answer by username_1 on 2020-06-22. Score: 1

I think you'll need to implement this with the `Elements::EVENT_AFTER_SAVE_ELEMENT` event and keep a record of the number.

If it doesn't need to be sequential 1,2,3 you could use a dynamic title and use {{object.sourceId}} which would be the entry id which will always increment

> **Comments:**
> **username_2**: Yeah, this. I wondered about using something like {craft.entries.section('pages')|length} in the Title Format field, but that would update the number to the total length every time you updated the entry. You may still run into problems with the user being able to change the number when they edit the page.  

---

