It works for me too, but I can't use this page when I go to overwrite Delete button on Tasks... It just does not show up in the available visualforce pages... Any ideas how to make it show up there?
I'm trying to create a page to override the Delete button on the task page if anyone other than the administrator tries to delete that task. I'm beginning to think that it's going to be impossible to have it work. If you have any suggestions, they would be greatly appreciated!! :)
Thanks guys for the code, but I need a bit further customization. My requirement is that a particular user named Vishal should only be able to delete tasks assigned to him. Here's my code.
Put standardcontroller="Task" in the page tag.
Jeremy
All Answers
There is a standard controller for Task. There's no standard set controller, but I don't think you would need that to override the Delete button.
Depending on what you want to do instead of Delete, though, you would probably need a controller extension. What should be the behavior of your page?
Jeremy
When user tries to delete task, it should check his profile - if it's admin then delete, otherwise warn that not allowed and send back to the record,
Here is the page that I have
Your code works in my organization, what bad results are you getting?
Jeremy
It works for me too, but I can't use this page when I go to overwrite Delete button on Tasks... It just does not show up in the available visualforce pages... Any ideas how to make it show up there?
Put standardcontroller="Task" in the page tag.
Jeremy
Ok. This is embarassing... I new I needed that tag but I did not know one existed for Tasks... Is that new for Summer 01 release?
orikker, did this end up working for you? I need the same function and I am surprised it is so hard to do something so simple!
It was a while ago. What exactly are you trying to do? :)
I'm trying to create a page to override the Delete button on the task page if anyone other than the administrator tries to delete that task. I'm beginning to think that it's going to be impossible to have it work. If you have any suggestions, they would be greatly appreciated!! :)
It's your lucky day today :)
This should work.
YOU ARE MY HERO!!! thank you so much
Thanks guys for the code, but I need a bit further customization. My requirement is that a particular user named Vishal should only be able to delete tasks assigned to him. Here's my code.
<apex:page action="{
!if($User.Username ='vsharma@cvent.com.cvent',
null,
urlFor($Action.Task.Delete, $CurrentPage.Parameters.id, [retURL='/00T'], true)
)
)
}"
standardController="Task">
<apex:pageBlock >
<apex:PageMessage summary="You are not allowed to delete Tasks"
severity="Warning"
strength="3"/>
<apex:pageMessages />
</apex:pageBlock>
</apex:page>
I don't know where & how to embeed 2nd condition (tasks assigned to Vishal only). Can you guys help please.
Best Regards,
Vishal Sharma
Thanks For the Code....
Thanks,
Sagar Lakhani