you can achieve this with data input and data input association, following is an example of it for userTask
<userTask id="_4" name="User Task" >
<ioSpecification>
<dataInput id="_4_inputInput" name="input" />
<inputSet>
<dataInputRefs>_4_inputInput</dataInputRefs>
</inputSet>
<outputSet>
</outputSet>
</ioSpecification>
<dataInputAssociation>
<sourceRef>variable.getName()</sourceRef>
<targetRef>_4_inputInput</targetRef>
</dataInputAssociation>
</userTask>
please note that variable must be declared as process variable on the process level.
HTH