Hi David
I can give you several hints to solve your problem.
1.) I think, that your function "fertigstellen" is executed before the popup dialog is opened, but you must also update the dialog component in your commandButton to see the updated variable value in the dialog.
2.) Because PF('userDialog').show() is a javascript function that is executed in the web browser, you can also use a javascript variable instead of a dialog process variable and a server round trip.
Something like:
<script>
var button_var ="none";
function showpopup(button_pressed)
{
button_var = button_pressed;
PF('popup_dlg').show();
}
function showButtonVar()
{
alert(button_var);
}
</script>
Call the function showpopup('xyz') on your commandbutton and to see the result on the dialog you add onShow="showButtonVar()"
3.) You can execute javascript functions from a script step with the RequestContext
e.g.
import org.primefaces.context.RequestContext;
String myscript = "PF('popup_dlg').show()";
RequestContext.getCurrentInstance().execute(myscript);