Passing dynamic value inside Javascript field of an element template

We are using Element Template and are using text fields and javascript field as below:

{
“label”: “templateName”,
“type”: “String”,
“value”: “abc”,
“binding”: {
“type”: “camunda:inputParameter”,
“name”: “templateName”
}
},
{
“label”: “retryTemplate”,
“value”: “retryTemplate”,
“type”: “Text”,
“binding”: {
“type”: “camunda:outputParameter”,
“source”: “var req = {‘dName’: execution.getVariable(‘itemA’),‘templateId’: execution.getVariable(‘PrePostTemplate’)};
JSON.stringify(req);”,
“scriptFormat”: “JavaScript”
},
“constraints”: {
“notEmpty”: true
}
}

Here PrePostTemplate is the name we should get from the first field(templateName). If the user changes the value of templateName, the value passed inside execution.getVariable(), should also be changed. Can we pass the value of one field to another here? If so, please let me know.

Thanks in advance.