You need to sign in to do that
Don't have an account?
Ben Aebischer
Test Class for Quote Trigger
Hi everyone,
I'm pretty new to Apex and I'm desperately looking for a test class for the following trigger:
Trigger QuoteTriggers on Quote (after insert, after update) {
Public static boolean IsRun = False;
for (Quote Q :[SELECT Id,Status, Opportunity.Account.Id, Opportunity.Approval_Status__c FROM Quote WHERE id IN :trigger.New]) {
If(Trigger.IsInsert){
ID QID = Q.ID;
If(Q.Opportunity.Approval_Status__c == 'Approved' && IsRun == False) {
Quote ThisQuote = new Quote (
Id = QID,
Status = 'Approved'
);
update ThisQuote;
IsRun = True;
}
}
If (Trigger.IsUpdate && IsRun == False && Q.Opportunity.Approval_Status__c == 'Approved') {
if (!QuoteStatusUtil.hasQuoteUpdated()) {
Q.Status = 'Approved';
QuoteStatusUtil.setQuoteUpdated();
update Q;
Could anybody help me please?
Thanks : )
I'm pretty new to Apex and I'm desperately looking for a test class for the following trigger:
Trigger QuoteTriggers on Quote (after insert, after update) {
Public static boolean IsRun = False;
for (Quote Q :[SELECT Id,Status, Opportunity.Account.Id, Opportunity.Approval_Status__c FROM Quote WHERE id IN :trigger.New]) {
If(Trigger.IsInsert){
ID QID = Q.ID;
If(Q.Opportunity.Approval_Status__c == 'Approved' && IsRun == False) {
Quote ThisQuote = new Quote (
Id = QID,
Status = 'Approved'
);
update ThisQuote;
IsRun = True;
}
}
If (Trigger.IsUpdate && IsRun == False && Q.Opportunity.Approval_Status__c == 'Approved') {
if (!QuoteStatusUtil.hasQuoteUpdated()) {
Q.Status = 'Approved';
QuoteStatusUtil.setQuoteUpdated();
update Q;
Could anybody help me please?
Thanks : )
please find out below link
https://appexchange.salesforce.com/listingDetail?listingId=a0N3A00000EFozgUAD
instal this test class genarator and try, you will get 100 % code covarage.
Thanks & Regards
Gopal M.