This is probably the most commonly asked question of all time.
It only takes a couple of lines of code to set the value into a workflow variable:
The Joget Marketplace has a free plugin called the Workflow Variable Update Process Tool . This is a process tool to easily update any number of workflow variables in your process. With this tool, you now do not need to use a BeanShell script.