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
BenPBenP 

remove "new" button from case page

How can I hide the new button on the case tab from certain users, or from a custom tab?  I have users who can create new workorders (custom object) through a custom button on the cases page, but they should not do so directly from the workorders page. 
Best Answer chosen by Admin (Salesforce Developers) 
RedtagRedtag

The only way around this I found was to override the New button with a Visualforce page that simply said

"Please create cases against the relevant Account".  Not great from a user point of view, but they learn not to click on the New button on the case tab.

All Answers

FleetmanFleetman

Hey mate, You can do this via each profile. For the users who you wish not to create new cases (or new records for Custom Objects) edit their profile, scroll down to the permissions and uncheck the Create checkbox next to cases (or Custom Object).

 

Hope that helps

 

Fleetman

BenPBenP
They need to be able to create a case, but just not with that button.  I want them to use a custom button instead.
cyndycyndy

I am interested in an answer to this question - I want to 'force' the user (support personnel) to open a new case from the Account page, rather than from the case tab. Is there a way to remove or hide the 'new' button on the case tab?  Has anyone been able to do this?

RedtagRedtag

The only way around this I found was to override the New button with a Visualforce page that simply said

"Please create cases against the relevant Account".  Not great from a user point of view, but they learn not to click on the New button on the case tab.

This was selected as the best answer
BenPBenP

I was attempting this, but ran into a problem.  I created a visualforce page, but when I try to override the button that page isn't available to choose.  I don't really know what i'm doing with visualforce, so that's probably the problem.  However, the page does display when I navigate directly to it.  The code is below, as you'll see it's very simple.

 

<apex:page > <h1>Please create new cases from the account page.</h1><br/> If the account exists, click the new case button there. If not, create the account then click the new case button. </apex:page>

 

BenPBenP
I found the solution to my issue.  you must have a controller type listed in your page.  I added standardController="Case", and that page option popped right up.
BenPBenP

So the new page works fine, but since i've overridden the new case button I have no way to create a new case.  I created a new button that points to a url, but that just points me to the new visualforce page.

 

Any ideas?

 

My button url

 

/500/e?retURL={!Account.Id}&def_account_id={!Account.Id}

 

 

 

RedtagRedtag
I think this is solved by doing things in the right order. Before you redirect the new case button, look at the url code that is associated with the standard new case button (you need this to incorporate into your custom new case button). Then override the standard new case button with your visualforce page. Then make your custom new case button visible on the account case related list.
BenPBenP

Thank you for your response.

 

That's what I did actually.  Just to be sure, I followed your steps today and got the same results.  Maybe I missed something else?  Must be something simple.  Is it possible for someone to post some working code?

BenPBenP

I found the solution, you must add nooverride=1 to your url which prevents it from being overridden.  Credit goes to werewolf though.

 

Final url is below:

 

/500/e?retURL=%2F{!Account.Id}&def_account_id={!Account.Id}&nooverride=1