New ticket can not be updated by function

New ticket can not be updated by function

Hi, I have a function which would change a field in a ticket.
This works fine, when I execute the function on an existing ticket.

But when I execute the function from a rule when a new ticket is created, the field will not be updated.
I have verified, that the function is executed.

So what do I have to change, that a function can change a field when the ticket is created?