I'm unable to update record type of a custom object.
Other fields are getting updated but not Record Type
Please help
Here is my code,
trigger UpdateRecordType on ZI_Quote__c (before Update) {
List<ZI_Quote__c> ZIQuotes = new List<ZI_Quote__c>();
Map<String,ID> RecordTypeMAP = new Map<String, Id>();
for (RecordType RecType: [Select Id, DeveloperName from RecordType where sObjectType ='ZI_Quote__c']){
RecordTypeMAP.put(RecType.DeveloperName, RecType.id);
}
For(ZI_Quote__c ZIQ : trigger.new){
IF (ZIQ.Hours_Remaining__c <= 0 && ZIQ.Status__c == 'Received From Supplier'){
ZIQ.RecordTypeID = RecordTypeMAP.get('Remaining hr');
ZIQuotes.add(ZIQ);
}
Else IF(ZIQ.Hours_Remaining__c <= 0 && ZIQ.Status__c == 'Submitted To Supplier'){
ZIQ.Buyer_Name__c= 'TEST';
ZIQ.RecordTypeid = RecordTypeMAP.get('Before 48 hr remaining time');
ZIQuotes.add(ZIQ);
}
}
}