function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tnstns 

Prevent Contact from being deleted if a certain field contains an integer > 0

We would like to prevent users from deleting a Contact record  if a certain field contains an integer > 0, and output a message that explains why it cannot be deleted.
 
I am experienced with the GUI side of Salesforce.com, but have no experience with Visualforce pages or APEX.

Can anyone assist me in creating a mechanism to prevent Contact deletion based on the criteria above? 
bob_buzzardbob_buzzard

You wouldn't need visualforce for this, just a before delete trigger that checks the value and adds an error to the contact if it is > 0.

 

The apex developer's guide has information and examples:  http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=langCon_apex_SOQL.htm|StartTopic=Content%2FlangCon_apex_SOQL.htm|SkinName=webhelp