Getting the articleId inside article creation screen

I am developing a custom field for selecting categories. Reason is that instead of the default dropdown, we want to have a tree-structure for our stakeholders with easy view of parent and subcategories.
I have developed everything and for existing articles, this works very fine.

Only problem I have: I am getting the article id from the url of the post (http://localhost:1337/.../api::article.article/3789), but in the creation screen there is no article id, since it’s just /create instead of /1523.

I would like to know how I can get the article id in the creation screen in order to save the selected categories to that article. Is this even possible, since I am afraid the new article does not have an id before I hit the save button. But maybe, there is another way?

Also, in general, I didn’t find any documentation on how the article creation works internally. That’s also why I update the categories of the articles in real time with direct PUT requests to the db. Maybe I can write the custom field in a way that Strapi understands the selected values when it generates the article on save?

Hope somebody has the time to help me out with that one or provide me with some resources to understand the create article screen internals a bit better.

Thank you very much!

This topic has been created from a Discord post (1234513880143626371) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

You can look how it’s done

Awesome, thank you very much!