0 votes
1 view
in Salesforce by (10k 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 (20.3k 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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !