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
EleniEleni 

Visualforce page delete button override multiple users

Hi, Im using the following code to override the Delete Button in a client's professional edition for accounts.  It works but I'm trying to add another user (extend this deleting privelege to the other System Admin).  Do you know how I can do this?? Thanks!

 

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

lrw7572lrw7572
Change it to "{!IF(AND($User.Alias != 'MPeck',$User.Alias != 'Other'),null,urlFor($Action.Account.Delete, $CurrentPage.Parameters.id, [retURL='/001'], true))}
EleniEleni

I used the suggested code but the second user is unable to delete:

 

<apex:page action="{!IF(AND($User.Alias != 'MPeck',$User.Alias != 'JWent'),
null,
urlFor($Action.Opportunity.Delete, $CurrentPage.Parameters.id, [retURL='/001'], true)
)
}"
standardController="Opportunity">
<apex:pageBlock >
<apex:PageMessage summary="You are not allowed to delete Opportunities"
severity="Warning"
strength="3"/>
<apex:pageMessages />
</apex:pageBlock>
</apex:page>

 

Since both of these users are system admins is there any way I can override the Delete Button and extend deleting privileges based on profile (System Admins) rather than by User.  Please let me know as soon as possible how both of the system admins can have deleting privileges while maintaing that the other users are unable to delete (in this case, Opps).