How can I run script in "Connection in" after finishing generate "Display name" and "Due Date"

In Connection in, I would like to add a script that will send assigned user an email to inform them that a task assigned to them was created.

In the email, I want to include display name and due date.

However, the script that generate display name and due date take few second to finish, so when the email script run, these values still "null".

How should I make the Bonita to make the email script wait until these values were generated? There seem to be a pause() function in Groovy script but I don't really want to use it if possible.