save existing attachment with a groovy script or something without interaction of the user

helllo,

i try to save a attachment which is declared as intern pdf.
i a userStep i can show the file and use the variable.
But in a later step i want to save the file to disk in a serviceStep with a groovyScript.

The problem is i dont see the attachment-variable and cannot use it in this step.

Why it is so? Should i need import a Framework or library before?

Often i have read that i have to create a new file which i fill with the stream of the attachment-content.

Please Help me