How to parse a dynamic choiceList defined in a Business Rule inside the UI Page

Ahsan Zafar
Tera Contributor
<body>
      <j:set var="jvar_table" value="${sysparm_table}"/>
      <j:set var="jvar_record_sys_id" value="${sysparm_sys_id}"/>
      <j:set var="jvar_choice_list" value="${JSON.parse(sysparm_choices)}"/>

      <g:evaluate>
        var list = JSON.parse(RP.getParameterValue("sysparm_choices"));
        var choiceList = new GlideChoiceList();
        choiceList.add('', '--None--');  
      </g:evaluate>

      <j:forEach var="jvar_item" items="${list}">
        <g:evaluate jelly="true">
          choiceList.add(jelly.jvar_item.value, jelly.jvar_item.displayValue);
        </g:evaluate>
      </j:forEach>
2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Ahsan Zafar 

I am able to save the UI page with the html you shared

could you please share screenshot where are you getting this error?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Screenshot 2023-11-08 184210.png
After saving the UI Page, when I click to try it, this is what I can see there