I have developed a Jira Plugin for Server in which I am sending the required data to the velocity template files from the Get Servlet using render method of Template Renderer (https://docs.atlassian.com/atlassian-template-renderer/1.5.2/apidocs/com/atlassian/templaterenderer/TemplateRenderer.html)
The code for that is given below:
<span>@ComponentImport</span>
<span>private</span> <span>final</span> TemplateRenderer templateRenderer;
Map<String, Object> data = service.populateDataForPlugin(pkey, pid, token,
manageFieldsRule, hideFieldService, mandateFieldService, configuration);
<span>// To render the velocity template UI with required data</span>
templateRenderer.render(<span>"templates/init.vm"</span>, data, res.getWriter());
Adding populateDataForPlugin code below:
<span>import</span> com.aidt.managefields.entity.ManageFieldRules;
<span>// Populate data map with required values to fetch it in doGet servlet</span>
<span>@Override</span>
<span>public</span> Map<String, Object> <span>populateDataForPlugin</span><span>(String pkey, String pid, String token,
ManageFieldsRule manageFieldsRule, HideFieldService hideFieldService,
MandateFieldService mandateFieldService, List<AmfConfigurations> configuration)</span> {
Map<String, Object> data = Maps.newHashMap();
data.put(<span>"pkey"</span>, pkey);
data.put(<span>"pid"</span>, pid);
<span>// Fetch existing Manage field rules from database</span>
List<ManageFieldRules> exisitingRules = manageFieldsRule.getRules();
List<ManageFieldRules> projectSpecificHidingRules = <span>new</span> <span>ArrayList</span><>();
List<ManageFieldRules> projectSpecificMandateRules = <span>new</span> <span>ArrayList</span><>();
<span>// Fetch Manage field rules present in current project</span>
<span>if</span> (exisitingRules != <span>null</span> && !exisitingRules.isEmpty()) {
<span>for</span> (ManageFieldRules rule : exisitingRules) {
<span>if</span> (rule.getPid().equals(pid) && rule.getPkey().equals(pkey) && rule.getOperation().equals(<span>"Hide"</span>)) {
<span>String</span> <span>hideIssueTypeIds</span> <span>=</span> rule.getIssueType().replaceAll(<span>"\\["</span>, <span>""</span>).replaceAll(<span>"\\]"</span>, <span>""</span>);
rule.setIssueType(hideIssueTypeIds);
projectSpecificHidingRules.add(rule);
}
<span>if</span> (rule.getPid().equals(pid) && rule.getPkey().equals(pkey) && rule.getOperation().equals(<span>"Mandate"</span>)) {
<span>String</span> <span>mandateIssueTypeIds</span> <span>=</span> rule.getIssueType().replaceAll(<span>"\\["</span>, <span>""</span>).replaceAll(<span>"\\]"</span>, <span>""</span>);
rule.setIssueType(mandateIssueTypeIds);
projectSpecificMandateRules.add(rule);
}
}
}
data.put(<span>"hideRuleList"</span>, projectSpecificHidingRules);
data.put(<span>"mandateRuleList"</span>, projectSpecificMandateRules);
<span>final</span> <span>Project</span> <span>project</span> <span>=</span> projectManager.getProjectByCurrentKey(pkey);
<span>// Fetch all issue types mapped to current project</span>
Collection<IssueType> projectSpecificIssueTypes = ComponentAccessor.getIssueTypeSchemeManager()
.getIssueTypesForProject(project);
<span>// Convert collection of issue type to list of maps with issue type id and issue type name</span>
List<Map<String, Object>> allIssueTypesInProject = ManageFieldsUtility
.getMapOfIssueTypesSpecificToProject(projectSpecificIssueTypes);
data.put(<span>"allIssueTypesInProject"</span>, allIssueTypesInProject);
<span>// Fetch all system fields in jira instance except fields which are already mandated</span>
List<Field> allSystemFields = mandateFieldService.findSystemFields();
<span>// Fetch all custom fields if current project is present in it's context</span>
List<CustomField> projectSpecificCustomFields = hideFieldService
.projectSpecificCustomFields(Long.parseLong(pid), issueTypes);
<span>// Fetch list of all custom fields excluding locked and message custom fields</span>
List<CustomField> customFieldsExLockedMessageCf = hideFieldService
.fetchCustomFieldsExLockedMessage(projectSpecificCustomFields, managedConfigurationItemService);
<span>// Concat System fields and Custom fields</span>
List<Field> allFields = Stream.concat(allSystemFields.stream(), customFieldsExLockedMessageCf.stream())
.collect(Collectors.toList());
<span>// Fetch final list of fields which are eligible to hide in current project</span>
List<Map<String, Object>> eligibleFieldsToHide = ManageFieldsUtility
.eligibleFieldsToHide(customFieldsExLockedMessageCf, allFields, exisitingRules, configuration);
data.put(<span>"hideIssueFields"</span>, eligibleFieldsToHide);
<span>// Fetch all custom fields in jira instance</span>
List<CustomField> allCustomFields = cfm.getCustomFieldObjects();
<span>// Fetch system fields, custom fields excluding locked fields and message custom fields</span>
List<Map<String, Object>> allFieldsExLockedMessageCf = mandateFieldService
.findAllFieldsExLockedMessageFields(allCustomFields, managedConfigurationItemService);
data.put(<span>"systemCustomFields"</span>, allFieldsExLockedMessageCf);
<span>// Fetch final list of fields which are eligible to mandate in current project</span>
List<Map<String, Object>> eligibleFieldsToMandate = ManageFieldsUtility.eligibleFieldsToMandate(allFields,
exisitingRules, configuration);
data.put(<span>"mandateIssueFields"</span>, eligibleFieldsToMandate);
<span>// Fetch all custom fields excluding locked and message custom fields</span>
List<Map<String, Object>> allCustomFieldsExLockedMessageCf = hideFieldService
.findAllCustomFieldsExLockedMessageCf(managedConfigurationItemService);
data.put(<span>"allCustomFields"</span>, allCustomFieldsExLockedMessageCf);
<span>// Add generated unique CSRF token</span>
data.put(<span>"csrfToken"</span>, token);
<span>return</span> data;
}In my velocity file, I am fetching RuleId from data map which is passed using template renderer using the following code:
#set ($ruleId = $rule.getID())
RuleId is $ruleId
But the value is not getting populated on Jira UI as seen in the attached screenshot:

But when I fetch the same Rule Id value in the backend, the values are present as expected. I am attaching the screenshot: 
The issue is data is present in the backend but the values are not getting populated on the Jira UI. Can anyone please help me in resolving this issue.
Jira Software version: 9.2.0 and 9.3.0