Creating a Multi Select list using Jelly

Gaspy
Tera Contributor

I am using a UI page in conjunction with a UI Action. In clicking the UI action, I am hoping to grab all of the fields from the form it is currently on and have them added to a multi select choice field, allowing the user to select what fields they'd like to copy. I am getting the modal to populate but can't get the field names to populate within the multi select field. Any thoughts? 

<j:jelly xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:script>new GlideSystem();</g:script>

<div id="templateContainer">
<div style="margin-bottom: 10px;">
    <!-- New div for label and select box for Template Type -->
    <div id="templateTypeDiv">
        <label for="templateType">Select Template Type:</label>
        <span style="display: inline-block; width: 10px;"></span>
        <select id="templateType" name="templateType" mandatory="true" onchange="updateButtonColor()">
            <option value="createStory">Create Story ONLY</option>
            <option value="createEntireEpic">Create Entire Epic</option>
        </select>
    </div>
</div>

<g:evaluate var="jvar_storyElementLabels" object="true" jelly="true">

var storyElementLabels = [];        
var gr= new GlideRecord('x_story_temp_story_template');
gr.addQuery('sys_id', "${sysparm_record}");
gr.query();
if(gr.next()){

var storyElements = gr.getElements();

for (var i = 0; i&lt; storyElements.length; i++){
 storyElementLabels.push(storyElements[i].getLabel());
}

}

storyElementLabels;

</g:evaluate>

    <div style="margin-bottom: 10px;">
    <label for="project">Select fields:</label>
    <select id='filter_task_type' class='select2-search' multiple='true'>
<option value="">All</option>
<j:forEach var="jvar_storyElementLabels" items="${storyElementLabels}">
<option value="${jvar_storyElementLabels[0]}">${jvar_storyElementLabels[0]}</option>
</j:forEach>
</select>
</div>
</j:jelly>
0 REPLIES 0