You need to sign in to do that
Don't have an account?

Override the delete button on Account
Hi,
Need to override the delete button on Account object such that the user is not able to edit the Account record if it has any Opportunity ot Service Agreement or Equipment record attached to it.
I have got two record types in Accounts named Customer Account and Sit Account. One should not not be able to delet the Customer Account if the Site Account attacjed to it has any Service Agreement or Equipment or Opportunity attached to it.
Need to override the delete button on Account object such that the user is not able to edit the Account record if it has any Opportunity ot Service Agreement or Equipment record attached to it.
I have got two record types in Accounts named Customer Account and Sit Account. One should not not be able to delet the Customer Account if the Site Account attacjed to it has any Service Agreement or Equipment or Opportunity attached to it.
Check if you can write a Validation rule with the criteria of attachment.
If attachment != null etc - throw error.
Also See the links below,
https://success.salesforce.com/answers?id=90630000000hVL4AAM
https://success.salesforce.com/answers?id=90630000000grTvAAI
Regards,
Ashish
I took the asumtion of override means you have to redirect to different page based on your condition.
To achive this you have to create custom to execute javascript.In the java script you need to use ajax call to get the records and check you condition.
Refer the below post:
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000923jIAA
You can override Delete action on the Account object. But first you have to create custom visualforce page with standard conroller equals to Account and controller extension.
Example of standard controller extension: Example of visualforce page:
After that you can associate custom visualforce page and 'Delete' action of Account. Use the following path:
Setup / Customize / Account / Buttons, Links, and Actions
Press Edit link related to 'Delete' action.
The dialog will be similar to the next picture:
Now you can put whole custom logic inside checkForDelete() method of controller CustomDelAccountContExt.
However, I would prefer method that was suggested by Ashish_SFDC. I mean using of Validation rules. It will be much easier and more clear.
Thanks
Varun
http://varunvatsa.blogspot.in/