You need to sign in to do that
Don't have an account?
chikku
How to get data picklist values with trigger?
I have picklist field name is Type__c and in that values are Disbursal and payment, where Disbursal=1000 & Payment is =5000.
My requirement is when I choose disbursal I need a trigger and show the values of disbursal of 1000 and the same as payment need to show if I chose a payment.
My requirement is when I choose disbursal I need a trigger and show the values of disbursal of 1000 and the same as payment need to show if I chose a payment.
This code of trigger. trigger TransactionAct on Loan_Transaction__c (after insert) { List<Timeline_Event__c> timelineList=new List<Timeline_Event__c>(); TimelineEventController tobj=new TimelineEventController(); ITimelineEventController timeAssignCtrl=new TimelineEventController(); IController conCtrl=new contactController(); for( Loan_Transaction__c trans :Trigger.New){ Timeline_Event__c tEvent=new Timeline_Event__c(); string rtype='', subtitle=''; if( Trigger.isAfter){ sObject c=conCtrl.getById(trans.Loan__c); if(trans.Type__c=='Disbursal'){ subtitle=rtype+'Disbursal of'; tEvent=(Timeline_Event__c)timeAssignCtrl.timelineTrigger(trans ,'trans Disbural',subtitle,'insert','trans' ); timelineList.add(tEvent); } else if(trans.Type__c=='Payment'){ subtitle=rtype+'Payment of'; tEvent=(Timeline_Event__c)timeAssignCtrl.timelineTrigger(trans,'trans Payment','',subtitle,'insert','tarns' ); timelineList.add(tEvent); } } } tobj.createMany(timelineList); }
getPickistKeyValuePair(Loan_Transaction__c,'Type__c');
public static map<string,string> getPicklistKeyValuePair(SObject objName, String fieldName) {
Map<String,String> result = new Map<String,String>();
Schema.sObjectType objType = objName.getSObjectType();
Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
list<Schema.PicklistEntry> values = objDescribe.fields.getMap().get(fieldName).getDescribe().getPickListValues();
for (Schema.PicklistEntry a : values) {
result.put(a.getValue(),a.getLabel());
}
return result;
}