Step 1: Create a new template file
Create a file that contains the code you wish to execute when you move assets through the workflow. This file can be a part of an existing template or a new template can be created. For example, if you create a new template, you can rename the output.aspx file to workflow_script.aspx.
Step 2: Open the workflow you want to apply the script to
1. Navigate to Settings > Workflow > Workflows

2. Double click on the [Workflow Name] to edit the worklfow.
Step 3: Update workflow states that should execute the script
1. Click on the workflow state that should execute the script.

2. In the Execute File field of the modal popup select the template file you created in step 1.

3. Hit Ok to the modal popup.
4. Save the workflow.