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);
}
}
}
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
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
Class
Trigger