function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Force2b_MikeForce2b_Mike 

InputField for Opportunity.StageName with Valid Stages by RecordType

I've noticed that if I use a simple inputField tag referencing the Opportunity.StageName field, VisualForce lists ALL of the Stages in the system instead of the just the stages that are valid for the current Opportunity.RecordTypeID. Is there a way to get VisualForce/Apex to do this? I can't find any documentation on how to retrieve StageName picklist values based on the RecordType ID.

 

Thanks,

 

Mike 

TehNrdTehNrd

Unfortunately this is not supported out of the box. The only way to do this is build the logic in a custom extension/controller or build a custom object with the two fields. RecordType and StageName. Then based on the RecordType you can query all of the StageNames.

 

-Jason

Force2b_MikeForce2b_Mike

I suspected this was the case. Using a custom object to relate the RecordType and StageName is probably the best way to go. Unfortunately my client has 7 Opportunity record types so there is quite a bit of data to work with.

 

Any word on when SalesForce will open this up through the API?