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
Chris HustedChris Husted 

Prevent Specific Contact Record Type for Being Deleted

Hello -

I'm trying to prevent ONLY one record type of Contacts ('Client') using a visualforce page redirect.

Here is my code so far, which is not allowing deletion of any Contact record types:

<apex:page action="{!if($User.Alias !='admin',
    null,
    urlFor($Action.Contact.Delete, $CurrentPage.Parameters.id, [retURL='/00T'], true)
    )
    }"
  standardController="Contact">
     <apex:pageBlock >
        <apex:PageMessage summary="You are not allowed to delete Client Contacts"
            severity="Warning"
            strength="3"/>
        <apex:pageMessages />
    </apex:pageBlock>
</apex:page>

Any advice on how to apply only the one record type ID we want to prevent from being deleted would be great.

Thanks!
-Chris

 
Terence_ChiuTerence_Chiu
Are you overriding the standard Delete action with the Visualforce page ?
Chris HustedChris Husted
Hi, Terence -

Yes. I removed the "Delete" button from the page layout for this record type then realized I need to do the same for the "Delete" option on the Related List view for this record type only.

Thanks!
Amna Amjad 13Amna Amjad 13
Hi chris,
I am trying to do something similar. Where you able to find a workaround to identify record types ?