choice lists in service portal

edsonf_
Kilo Explorer

If these values were saved as values in a table B. How do I display them from a reference field after they were selected and saved in the table A.

find_real_file.png

2 REPLIES 2

Community Alums
Not applicable

Is this a table field or a variable on a catalog item, or is it a custom field you coded?



If it's a table field or a variable, the choice list should take care of itself; just configure it as you would for a normal field/variable in the tool, and it should be available on the item.



if its something you've coded, you'll probably have to query your list out of table B, and then loop through an array (or use ng-repeat) to put the choices into the list.



BUT...



If it's a table field or a catalog item whose choices you modify at/after page load with a script, you'll probably still have to use the array/ng-repeat route.


Would you please be able to send me a working example of the this implementation, these aforementioned values are stored in Table B. I was able to code to display the values and save its sys id in   the reference field in Table A. I am not able to display the correct value of the record when if I choose to come back to the saved record. I see only the original choice list values.



HTML Template.


<div class="form-group">  


        <label class="col-md-4 control-label" for="selectRank">Rank</label>


                    <div class="col-md-4">


                    <select id="select_rank" name="select_rank" class="form-control" ng-model="c.data.select_rank"   ng-options="rank.name for rank in c.data.ranks" ng-required="true">


<option value="" disabled>-- Choose a Rank --</option>


</select>


      </div>      


  </div>  





Server script.


gr.addQuery('sys_id', input.sys_id);


gr.query();


gr.next();


gr.setLimit(1);


data.interview=gr.getDisplayValue('interview');         --   This is   a text box and it works.


data.select_rank=gr.getValue('rank');                                       -- This is a choice list and   it does not work



Please let me know.