0

I have a visualforce page to generate a OpportunityLineItem. It is launched from the Opportunity page. I want a picklist for users to enter a custom field Product_Type__c.

The Opportunity is the controller of record on the page.

I can make this list manually in code, but how do I query to get the custom field values Product_Type__c as a picklist on the page?

How do I assign this to a value and how do I restrict values? Example:

//manual list option    
       public List<SelectOption> getEmailTypes() {
        List<SelectOption> options = new List<SelectOption>();

        options.add(new SelectOption('Intro','Intro'));
        options.add(new SelectOption('Promotional','Promotional'));
        return options;
    }
  • Schema.DescribeFieldResult fieldResult = Opportunity.Product_Type__c.getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); use the above list in select option – DOMINIC EDWARD Aug 22 '17 at 14:59
  • Thanks. Perhaps this is answer? Also, how do I assign this in the record creation? – jaw999 Aug 22 '17 at 15:23
  • I have split out part of this to another question – jaw999 Aug 22 '17 at 17:55
  • Do you need to display the picklist in visualforce page?? – DOMINIC EDWARD Aug 23 '17 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.