You need to sign in to do that
Don't have an account?
Kyo
Code Coverage 18% I can add it to me?
Code Coverage 18%
trigger UpdateType on Quotes__c (after update) { for(Quotes__c Q:trigger.new){ if(Q.Status__c== 'Rejected'){ Opportunities__c[] OP = [Select Id,name,Stage__c from Opportunities__c Where Id =: Q.OpportunitiesID__c]; for(Opportunities__c O:OP){ O.Stage__c = 'Closed Lost'; O.Reason_for_Lost__c = 'Please input Data'; } update OP; } else if(Q.Status__c== 'Accepted'){ Opportunities__c[] OPP = [Select Id,name,Stage__c from Opportunities__c Where Id =: Q.OpportunitiesID__c]; for(Opportunities__c OA:OPP){ OA.Stage__c = 'Closed Won'; } update OPP; } } }
Test
@isTest private class TestUpdateType{ static testMethod void myUnitTest() { Account Acc = new Account(Name='test'); insert Acc; Opportunities__c O = new Opportunities__c(Account_Name__c=Acc.Id,Stage__c='Prospecting',Probability__c='10%',Unit__c = 'Kg',Currency__c = 'Bath',Reason_for_Lost__c ='Test'); insert O; Quotes__c Q = new Quotes__c(OpportunitiesID__c=O.Id); insert Q; } }
Thank you so much.
Hi Kyo,
Please try this and let me know if you face any problem, also if doesn't resolve your problem.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
All Answers
Hi Kyo,
Please try this and let me know if you face any problem, also if doesn't resolve your problem.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Thank you so much Ankit. Code Coverage 100% Perfect!