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
santhoshsanthosh 

Opportunity Stage PickList and Recort Type

Hello,

I am Afzal from Hyderabad, India.

I am getting all the picklists and picklist values for an opportunity based on the record type id. But for SalesStage picklist, I am unable to make out which picklist value is isWon or isClosed.

Any help on this, would be appreciated. Below is the source code I've written.

DataSet dsRet = new DataSet();
if(strRecordTypeID!=null && strRecordTypeID.Trim()!=""){

DescribeLayoutResult objDLR = MY_CUSTOM_CLASS.getDescribeLayout(strSFObjectName,objSfConnection);
foreach(RecordTypeMapping objRTM in objDLR.recordTypeMappings){

if(strRecordTypeID==objRTM.recordTypeId){

foreach(PicklistForRecordType objPRT in objRTM.picklistsForRecordType){

DataTable dtRet = new DataTable(objPRT.picklistName);
dtRet.Columns.Add("label");
dtRet.Columns.Add("value");

foreach(PicklistEntry objPE in objPRT.picklistValues){

if(objPE.active){

DataRow newRow = dtRet.NewRow();
newRow["label"] = objPE.label;
newRow["value"] = objPE.value;
dtRet.Rows.Add(newRow);

}

}
dsRet.Tables.Add(dtRet);

}

}

}

}

DevAngelDevAngel
I believe you need to cross-reference with the picklist values from the describeSObject call.

Cheers
Mohammad AfzalMohammad Afzal
can you please explain in more detail, what you meant? 
 
I am not sure, why/how I should use describeSObject call, when I am already using describeLayout call.
 
regards,
Mohammad Afzal.
DevAngelDevAngel
The describe layout describes the layout and some picklist values.  For more detailed information about picklist fields and their values you need to execute the describe sobject.