You need to sign in to do that
Don't have an account?

Before delete trigger makes it unable to delete records
Hello, I've got a trigger, which causes that I am unable to delete records. This shows up:
There's a problem saving this record. You might not have permission to edit it, or it might have been deleted or archived. Contact your administrator for help.
There's a problem saving this record. You might not have permission to edit it, or it might have been deleted or archived. Contact your administrator for help.
trigger QuoteLineItemEmailBeforeDelete on QuoteLineItem (before delete) { Set<Id> quids = new Set<Id>(); for(QuoteLineItem qli :Trigger.Old) { quids.add(qli.QuoteId); } Quote[] quo = [Select Id from Quote Where id In :quids]; Messaging.reserveSingleEmailCapacity(trigger.size); List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>(); for (QuoteLineItem qli : Trigger.old) { Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setToAddresses(new String[] {'test@example.com'}); email.setSubject('Oznámení o změně nabídky'); email.setPlainTextBody('Došlo ke změně nabídky' + Quo[0].Name + '.<br>' + 'Pro otevření záznamu v Salesforce klikněte na následující odkaz:<br>' + URL.getSalesforceBaseUrl().toExternalForm() + '/' + qli.Id); emails.add(email); } Messaging.sendEmail(emails); }
All Answers