hi vijay,
Please modify the code , i am sure it will work fine
function optionSetChanged() {
///<summary>
/// Change the dependent picklist values based on the value selected in the control picklist.
///</summary>
var _selectedCasetype = Xrm.Page.getAttribute("new_casetype").getText();
if(_selectedCasetype != null){
var _collection = getCollection();
var _selectedCity = null;
var _subCaseCat = Xrm.Page.ui.controls.get("new_subcasetype");
if (_subCaseCat != null)
_selectedCity = _subCaseCat.getAttribute().getValue();
var _subCaseOptions = _subCaseCat.getAttribute().getOptions();
// If Main_Case_Type is empty, then clear the CitIES field.
if (_selectedCasetype == "") {
_subCaseCat.clearOptions();
}
else {
for (var i = 0; i < _collection.length; i++) {
if (_selectedCasetype.toLowerCase() == _collection[i].Main_Case_Type.toLowerCase()) {
_subCaseCat.clearOptions();
for (var j = 0; j < _collection[i].Sub_Case_Type.length; j++) {
for (var k = 0; k < _subCaseOptions.length; k++) {
if (_collection[i].Sub_Case_Type[j].toLowerCase() == _subCaseOptions[k].text.toLowerCase()) {
_subCaseCat.addOption(_subCaseOptions[k]);
break;
}
}
}
break;
}
}
if (_subCaseCat != null && _selectedCity != null)
_subCaseCat.getAttribute().setValue(_selectedCity);
}
}
else{
alert("Please select an option");
Xrm.Page.getAttribute("new_subcasetype").setValue(null);
}
}
function getCollection() {
///<summary>
/// Creates and returns a collection of Sub_Case_Type with respect to their Countries.
///</summary>
var _collection = new Array();
var CARDS_SubCat = new Array("CARD ACTIVATION", "CARD LOST", "CHANGE OF FIN", "CHANGE OF PHOTO", "FAULTY", "LOST & FOUND", "NON REC OF CARDS");
var CARDS_obj = { Main_Case_Type: "CARDS", Sub_Case_Type: CARDS_SubCat };
_collection.push(CARDS_obj);
var LINKPOINTS_SubCat = new Array("CHECK LPS BAL", "EXP LPS", "OCBC STMT LPS", "LPs Discrepancy", "Duplicate LPs Crediting", "Duplicate LPs Reversal", "LPs Adjustment", "LPs Reversal", "Multiply redemption", "");
var LINKPOINTS_obj = { Main_Case_Type: "LINKPOINTS", Sub_Case_Type: LINKPOINTS_SubCat };
_collection.push(LINKPOINTS_obj);
var ONLINE_REDEMPTION_SubCat = new Array("PROMOTION", "STARBUY", "KC Campaign", "KE Campaign", "DS Campaign", "Crazy LPs", "LBTC", "Reward Items");
var ONLINE_REDEMPTION_obj = { Main_Case_Type: "ONLINE REDEMPTION", Sub_Case_Type: ONLINE_REDEMPTION_SubCat };
_collection.push(ONLINE_REDEMPTION_obj);
var UPDATE_PARTICULARS_SubCat = new Array("Update Name", "Update Email Address", "Update Mobile No", "Update Residential No", "Update IC/FIN", "Crazy LPs", "Update Address");
var UPDATE_PARTICULARS_obj = { Main_Case_Type: "UPDATE PARTICULARS", Sub_Case_Type: UPDATE_PARTICULARS_SubCat };
_collection.push(UPDATE_PARTICULARS_obj);
var Service_Recovery_SubCat = new Array("Lapse of Service", "Technical Glitch", "Vendor Error", "MED Request", "Deceased Member", "Resigned Member");
var Service_Recovery_obj = { Main_Case_Type: "Service Recovery", Sub_Case_Type: Service_Recovery_SubCat };
_collection.push(Service_Recovery_obj);
var OTHERS_SubCat = new Array("COMPLAINT", "FOODFARE STOREVALUE", "FP REBATES", "OCBC VISA QUERIESt", "RECOGNITION EVENT", "ONLINE SURVEY");
var OTHERS_obj = { Main_Case_Type: "OTHERS", Sub_Case_Type: OTHERS_SubCat };
_collection.push(OTHERS_obj);
var Outbound_Calls_SubCat = new Array("Events", "Promotion");
var Outbound_Calls_obj = { Main_Case_Type: "Outbound Calls", Sub_Case_Type: Outbound_Calls_SubCat };
_collection.push(Outbound_Calls_obj);
var PDPA_SubCat = new Array("Do Not Call", "Do Not SMS", "Do Not Mail", "Do Not Email", "Do Not Fax", "Do Not Send Card", "Unsub All Channels");
var PDPA_obj = { Main_Case_Type: "PDPA", Sub_Case_Type: PDPA_SubCat };
_collection.push(PDPA_obj);
var PDPA_Consent_SubCat = new Array("Call", "SMS", "Mail", "Email", "Fax", "All Channels");
var PDPA_Consent_obj = { Main_Case_Type: "PDPA Consent", Sub_Case_Type: PDPA_Consent_SubCat };
_collection.push(PDPA_Consent_obj);
return _collection;
}
Hope it helps !! If so, Mark my answer as Verified !!
Regards,
Nithin