You need to sign in to do that
Don't have an account?
Jamie Gelep
Need help with VisualForce page to prevent users from deleting Leads
Here's my code I'm trying to use but I was only given the code for one user. I don't know what changes I need to make to have this work for multiple users. I'm not a programmer and would love some help! Thank you!
<apex:page action="{!if($User.Alias !='user1,user2,user3,user4,user5',
null,
urlFor($Action.Lead.Delete, $CurrentPage.Parameters.id, [retURL='/00Q'], true)
)
}" standardController="Lead">
<apex:pageBlock >
<apex:PageMessage summary="You are not allowed to delete Leads. Please contact your Field Marketing Manager for assistance." severity="Warning" strength="3"/>
<apex:pageMessages />
</apex:pageBlock>
</apex:page>
<apex:page action="{!if($User.Alias !='user1,user2,user3,user4,user5',
null,
urlFor($Action.Lead.Delete, $CurrentPage.Parameters.id, [retURL='/00Q'], true)
)
}" standardController="Lead">
<apex:pageBlock >
<apex:PageMessage summary="You are not allowed to delete Leads. Please contact your Field Marketing Manager for assistance." severity="Warning" strength="3"/>
<apex:pageMessages />
</apex:pageBlock>
</apex:page>
from here you can add or remove the users
action="{!if($User.Alias !='user1,user2,user3,user4,user5',
thanks
you can add or remove user's alias name to prevent it...
please check adn provide the user alias name from you want to hide the deleteing...
thanks
Just paste below code in your page and let us know whether it works or not.
<apex:page action="{!if($User.Alias !='',
null,
urlFor($Action.Lead.Delete, $CurrentPage.Parameters.id, [retURL='/00Q'], true)
)
}" standardController="Lead">
<apex:pageBlock >
<apex:PageMessage summary="You are not allowed to delete Leads. Please contact your Field Marketing Manager for assistance." severity="Warning" strength="3"/>
<apex:pageMessages />
</apex:pageBlock>
</apex:page>
Warm Regards,
Darshan Shah
You can associate one custom controller and there in action method you can simply get the all user list and check and set one boolena true false adn then you can render your message on page conditionally from there..
Thanks
You want users listed in code need to delete the lead.
find below code which will suffice your problem.
If there are multiple users then you just need to add userAlias in OR(||) condition shown below as underline.
<apex:page action="{!if(($User.Alias =='user1' || $User.Alias =='user2' || $User.Alias =='user3'),
urlFor($Action.Lead.Delete, $CurrentPage.Parameters.id, [retURL='/00Q'], true),
null
)
}" standardController="Lead">
<apex:pageBlock >
<apex:PageMessage summary="You are not allowed to delete Leads. Please contact your Field Marketing Manager for assistance." severity="Warning" strength="3"/>
<apex:pageMessages />
</apex:pageBlock>
</apex:page>
Warm Regards,
Darshan Shah
Invalid parameter for function URLFOR
Error is in expression '{!if($User.Alias !='BJohn', null, urlFor($Action.Account.Delete, $CurrentPage.Parameters.id, [retURL='/001'], true) )}' in component <apex:page> in page preventaccountdelete
Here is the code I'm using:
<apex:page action="{!if($User.Alias !='MYNAME',
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>
Thank you very much for any help you can provide!