You need to sign in to do that
Don't have an account?
editIng picklist from visualforce page?
I had created a visualforce page name resolutin and has a field name status
Status field has nine picklist option includind closed
The is a resolution controler class i had created.
following is the visualforce page page block section that has status field:
<apex:pageBlockSectionItem />
<apex:pageBlockSectionItem labelStyle="white-space:nowrap;" rendered="true">
<apex:outputLabel value="Status" for="status"/>
<apex:inputField id="status" label="Status" value="{!case.Status}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem labelStyle="white-space:nowrap;">
<apex:outputLabel value="Status Details" for="statusdetails"/>
<apex:inputField id="statusdetails" label="Status Details" value="{!case.StatusDetails__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:panelGrid>
</apex:pageBlock>
<apex:pageBlock mode="maindetail">
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!resolveCase}" value="Save" rendered="{!errorCode <> 1}"/>
<apex:commandButton action="/{!case.id}" value="Cancel" immediate="true" />
</apex:pageBlockButtons>
AND FOLLOWING IS THE CASE CONTOLLER:
//---Initialize the controller
public CaseResolution (ApexPages.StandardController stdController) {
controller = stdController;
c = (Case)controller.getRecord();
if ((c.status == 'Resolved') ) {
errorCode = 1;
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Can\'t resolve the case. Case has been ' + c.status + ' already.'));
} else {
c.status = 'Resolved';
c.statusdetails__c = null;
this.level1ResCode = c.ResolutionCodeLevel1__c;
this.level2ResCode = c.ResolutionCodeLevel2__c;
this.level3ResCode = c.ResolutionCodeLevel3__c;
resultSize = 0;
Hello @rules!
Correct me if I'm wrong but you're saying that you want to be able to add new values to your picklist from the visualforce page.
If this is the case then the solution is pretty simple. Just add another input text field that appears below the picklist. See here: http://www.forcetree.com/2009/06/dynamically-add-values-to-picklist.html
Have a nice day,
Adi
Hmmm, I don't think you can do it directly from code... The metadata api has a way(removing the picklist value from a certain RecordType) but I don't know how you could do that from apex.
See here for a more detailed discussion: http://boards.developerforce.com/t5/Apex-Code-Development/Any-way-to-obtain-picklist-values-by-record-type/td-p/287563
Tkx,
Adi