I need to display all the picklist values from the case object using the HTML syntax in visualforce page.

<script type='text/javascript' src='https://c.la1-c1cs-frf.salesforceliveagent.com/content/g/js/41.0/deployment.js'></script>
<script type='text/javascript'> 
    (function() { 
        function handlePageLoad() { 
            var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)"); 
                                                                decodeURIComponent(endpointMatcher.exec(document.location.search)[1].replace("javascript:", "")));
        } if (window.addEventListener) { 
            window.addEventListener('load', handlePageLoad, false); 
        } else { window.attachEvent('onload', handlePageLoad, false); 
    #label1 {display:block; width:30px; height:10px; text-align:left;}

    div.text { 
    margin: 0; 
    padding: 0; 
    padding-bottom: .25em; 
    padding-top: .25em; 

    div.text label { 
    margin: 0; 
    padding: 0; 
    display: block; 
    font-size: 100%; 
    padding-top: .1em; 
    padding-right: .25em; 
    width: 6em; 
    text-align: right; 
    float: left; 

    div.text input, 
    div.text textarea { 
    margin: 0; 
    padding: 0; 
    display: block; 
    font-size: 100%; 

<h1>Live Agent Pre-Chat Form </h1><br/>


<form method='post' id='prechatForm'>

    <div class="text">     
        <label for="phone">Phone: </label> <input type='text' name='liveagent.prechat:ContactPhone' id='phone' /><br />
    <div class="text">     
        <label for="message">Message: </label> <input type='text' name='liveagent.prechat:CaseMessage' id='message' required="true" /><br />

    <div class="text">
        <label for="message">Product Category: </label>

        <select name="liveagent.prechat.buttons">  
            <option value="{!Case.Coheris_CRM_Axis__c}">{!Case.Coheris_CRM_Axis__c}</option>  

    <input type='submit' value='Chat Now' id='prechat_submit' />

    <style type="text/css">
        p {font-weight: bolder }


The product category values should be drop down field with the picklist values found in case field 'Product Category'

  • Is there any particular reason why you're avoiding using <apex:inputField value="{!Case.Product_Category__c}"> here? Provided that Product_Category__c is your picklist field, that single line of markup would give you a drop-down with the active picklist values.
    – Derek F
    Oct 10, 2017 at 13:38
  • I am using Live Agent API and I need to add the name with the format name='liveagent.prechat:xxx'
    – Anna
    Oct 10, 2017 at 16:54

1 Answer 1


I have figured out the answer:


    Schema.DescribeFieldResult fieldResult = Case.product_category__c.getDescribe();
    List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
    for( Schema.PicklistEntry f : ple){
        prodCatMap.put(f.getValue(), f.getLabel());


            <select name="liveagent.prechat:prodCategory" id='prodCategory' required="true" class="input selectProd">
                <apex:repeat value="{!prodCatMapList}" var="prodcat">
                    <option value="{!prodcat}">{!prodCatMap[prodcat]}</option>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .