You need to sign in to do that
Don't have an account?
SAHG-SFDC
Test Class To Test If Picklist Values Changed
HI , I have a trigger for which I am trying to write a test class
Business Scenario if the stage changes then chk/unchk the box and the stage should be checked for the Primary record
Business Scenario if the stage changes then chk/unchk the box and the stage should be checked for the Primary record
set < id > ids2 = new set < id > (); set < id > Checkids = new set < id > (); set < id > Uncheckids = new set < id > (); if (trigger.isinsert || trigger.isupdate) { for (Proposal__Proposal__c p: trigger.new) { if (p.Proposal__Primary__c == true && p.Proposal__Approval_Stage__c == 'Accepted') { Checkids.add(p.Proposal__Opportunity__c); } if (p.Proposal__Primary__c == true && p.Proposal__Approval_Stage__c != 'Accepted') { Uncheckids.add(p.Proposal__Opportunity__c); } if (p.Proposal__Primary__c == false && p.Proposal__Approval_Stage__c == 'Accepted') { Uncheckids.add(p.Proposal__Opportunity__c); } } } list < opportunity > opptoupdate = new list < opportunity > (); for (opportunity o: [select id, Has_Primary_Accepted_Quote_Proposal__c from opportunity where id in : Checkids and Has_Primary_Accepted_Quote_Proposal__c = false]) { o.Has_Primary_Accepted_Quote_Proposal__c = true; opptoupdate.add(o); } for (opportunity o: [select id, Has_Primary_Accepted_Quote_Proposal__c from opportunity where id in : Uncheckids and Has_Primary_Accepted_Quote_Proposal__c = true]) { o.Has_Primary_Accepted_Quote_Proposal__c = false; opptoupdate.add(o); } if (opptoupdate.size() > 0) { update opptoupdate; } } else { if (trigger.isdelete) { for (Proposal__Proposal__c p: trigger.old) { if (p.Proposal__Primary__c == true ) { ids2.add(p.Proposal__Opportunity__c); } } }