You need to sign in to do that
Don't have an account?
Tyler Zika
return the selected value of a picklist
Hello,
From this documentation https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Schema_PicklistEntry.htm#apex_Schema_PicklistEntry_getLabel
I see how how to return values from a custom picklist value. I've implented to code in my Visualforce controller like so.
How to I get the one selected picklist value?
From this documentation https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Schema_PicklistEntry.htm#apex_Schema_PicklistEntry_getLabel
I see how how to return values from a custom picklist value. I've implented to code in my Visualforce controller like so.
public List<PicklistEntry> transportation { get { Schema.DescribeFieldResult F = GO_Event__c.Transportation__c.getDescribe(); List<Schema.PicklistEntry> P = F.getPicklistValues(); return P; } }
The problem is it's returning all the values instead and other code instead of just the one selected value in the record. Here is the Visualforce code
<li>{!transportation}</li>and a screen shot of the output on the page.
How to I get the one selected picklist value?
Hi Tyler,
There is no impact of the data type. I think the field is not visible for the logged in user from which you are viewing the page.
Please check the FLS of the "Transportation__c" field.
Thanks,
Abhishek Bansal
All Answers
Please use the below code :
Please let me know if you need more help or information on this.
Thanks,
Abhishek Bansal
The API name in the object is called Transportation__c, which is in the GoEvent SOQL call.
When I type in my VF page, it doesn't return anything, but works for all the other values list in the GoEvent. I think the problem is because it's a picklist.
You are going in the wrong direction if you want to show the value of the Picklist from your record.
In order to show the picklist value of a single record you have to do something as mentioned below :
Please let me know if you need more help on this.
Thanks,
Abhishek Bansal
Hi Tyler,
There is no impact of the data type. I think the field is not visible for the logged in user from which you are viewing the page.
Please check the FLS of the "Transportation__c" field.
Thanks,
Abhishek Bansal