3 Replies Latest reply on Dec 11, 2018 12:15 PM by Niels IH

    apex.util.applyTemplate with selectlist item

    Niels IH



      I was wondering why apex.util.applyTemplate substitutes the display value of a selectlist item instead of the actual value.

      Is this intended behaviour or a bug?


      For example on a page with a selectlist item P1_DEPT enter this in the console:




      It will show the display value of the department instead of the id.

        • 1. Re: apex.util.applyTemplate with selectlist item
          Franck N



          This function is intended to process Application Express style templates in the browser. However it doesn't have access to all the data that the server has. When substituting page items and column items it uses the current value stored in the browser not what is in session state on the server. It does not support the old non-exact substitutions (with no trailing dot e.g. &ITEM).





          • 2. Re: apex.util.applyTemplate with selectlist item
            John Snyders-Oracle


            It is intended that applyTemplate uses the display value of items. We think this is the most common case since the output of templates is most often used for display. There currently isn't any way to change this. What is your use case where you need the value?


            A workaround may be to set a hidden item with the select list item value every time it changes and use the hidden item in the template. Since hide items don't have a display value you will get the value.


            Another option is to get the value yourself and put it in the extraSubstitutions option.



            • 3. Re: apex.util.applyTemplate with selectlist item
              Niels IH

              Thanks John for clearing this up.

              My use case is a LOV plugin that has to get the value of the selectlist item to pass it on to a modal page.


              I have now solved this by getting the value myself and using #placeholders# with apex.util.applyTemplate.