-
How to show error message on the detail page of Salesforce sobject through before delete trigger?
I want to show error message on Account detail page, given below trigger shows error on the different page :-
trigger testDelete on Account (before delete)
{
List <Account> acc = [SELECT Id, (SELECT Id FROM Opportunities ) FROM Account WHERE Id IN : Trigger.old];
for(Account a : acc)
{
if(a.Opportunities.size()>0)
{
Trigger.oldmap.get(a.Id).addError('Cant Delete');
}
}
}
Log In to reply.
Popular Salesforce Blogs
Getting Started With Salesforce Pardot | The Basics
Pardot Pardot is Salesforce's B2B selling automation robotization arrangement. In case you're a business that offers to various organizations (or B2B), Pardot can computerize your…
How to Use "WORKBENCH" with Salesforce!
Workbench is a tool designed for administrators and developers to connect with Salesforce organizations. Salesforce Workbench provides support for the Force.com Partner, Bulk, Rest, Streaming,…
Salesforce Salaries
The range and scope of opportunities available to a Salesforce professional are among the best in the IT industry and might continue to rise in…