Custom definition field defines custom content for template file, not for output name pattern. You could create Groovy dataset in Root report band and place script there.
Unfortunately, only the first parameter is processed in output name pattern. You could also work around this problem forming parameter for output name pattern pattern in the dataset. For example, create report band with name Title and create Groovy dataset for that report with script like following: