Set default value for metadata in setting and on state action

Hi!

I want to set the value for a metadata field with a part of UUID, so, I have this Django template:

{{ document.uuid | lower | phone2numeric | split:"-" | last |slice:'8:'}}

But when I upload the document, with this metadata field is optional, there is no metadata and value filled in the uploaded document. So, I tried another way is to set the value for it via workflow by 2 actions as below:


However, it only shows that the metadata field is filled with empty value.

Does anyone know what is the issue and how should I resolve it?