Templater - prompt for properties and filename

What I’m trying to do

Create a new note which prompts for few properties and use couple of this properties for file title.

Things I have tried

In properties the prompt method works as expected, for e.g.

<% await tp.system.prompt("Day?") %>

When trying to use on of this properties to set file name, it fails

<% tp.file.rename(tp.frontmatter.topic) %>

Tried different combination and found frontmatter does not have the value yet.

There are many posts about setting properties or renaming a file, but couldn’t find anything which talks about both.

Thanks in advance.