Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Salesforce by (13.1k points)
I have 4 contact in one account and I want to delete the contacts but want 1 contact should not be deleted. Is it possible using trigger?

Can anyone help me with this?

1 Answer

0 votes
by (26.7k points)
edited by

You can have it without using triggers, you can try it by Roll-Up summary that will going to count records, and can able to add a validation rule on account like:

ContactCount__c = 0 &&  PRIORVALUE(ContactCount__c) > 0

I hope this will help.

Want to become a salesforce expert? join salesforce lightning training now!!

Related questions

Browse Categories

...