function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Projjwal LahiriProjjwal Lahiri 

Can any one share the trigger code to approve a quote automatically?

Anilkumar KotaAnilkumar Kota

Hi Projjwal,

Please refer these links for  approve a quote automatically.

http://salesforce.stackexchange.com/questions/121097/quote-trigger-for-approved-quotes-only/121099
https://developer.salesforce.com/forums/?id=906F000000091obIAA

Leo10Leo10
Hi
Class
 
public with sharing class QuoteServices
{
    public static void validateNotApproved(List<Quote> records)
    {
        for (Quote record : trigger.new)
        {
            if (record.Approval_Stage__c == 'Approved')
                record.addError('Replace this text with a Custom Label');
        }
    }
}

Trigger
trigger Quote on Quote (before delete)
{
    if (trigger.isBefore)
    {
        if (trigger.isDelete)
        {
            validateNotApproved(trigger.new);
        }
    }
}

 
Projjwal LahiriProjjwal Lahiri
Hi, Thanks for helping me. But one thing I want to ask you that in the trigger where I can put the criteria that if the discount >20% then the quote will be go for submit for approval? Warm Regards, Projjwal Kr. Lahiri