• Mohammad Afzal
  • NEWBIE
  • 0 Points
  • Member since 2006

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

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);

}

}

}

}