-
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
Salesforce Administrator Salaries - Get All the Details
Salesforce is the world’s most giant client magnet at the moment and is expected to get 10 times more extensive in the coming decade. It…
The Definitive Guide for Sharing Rules in Salesforce
One of Salesforce's key objectives is to integrate marketing, sales, commerce, service, and IT departments regardless of geographic location via its customer service component known…
Self Service - The key for Customer Satisfaction and Cost reduction
Self-service is the practice of serving oneself, classic example is the Automatic Teller Machines(ATMs) in the banking world, which revolutionized how people withdraw and deposit…