-
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 Integration with OpenAI : Revolutionizing Image Generation
Hey Guys, today we are discussing DALL-E (which is a product of openAI) and Salesforce Integration (Salesforce Integration with OpenAI). DALL·E is designed to generate coherent…
Interactive Sales Quotes: Streamline Proposal Creation
Old-school Sales Quoting Process and its Challenges In the old-school quoting process, sales representatives would manually gather product information, pricing details, and discounts, often relying…
NetSuite and Salesforce Integration using Restlet
Salesforce and NetSuite are both very popular Customer Relationship Management solutions. Even though both can be labeled two kinds of ‘CRM’ they are very different…