-
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
Introduction to Salesforce Conga Composer
Blog
in AppExchange, Salesforce
The growing demand of making everything digital and prior focus to make documents created and verified on the internet only, It is important to build…
Step by Step Guide for Salesforce Knowledge Implementation
Blog
in Salesforce
Salesforce Knowledge management capability provides the ability to solve multiple queries or incidents by providing the knowledge base by using articles. This can be utilized…