0

We want to create a btn that is only rendered to certain profiles and only allows certain profiles to change a record type of a lead, by going to the record type selector without creating a visualforce page and apex. Can I do this?

Also, I know there's some general wierdness with the record type selector, is there anything I should be

'https://cs15.salesforce.com/setup/ui/recordtypeselect.jsp?id='
+{!Lead.id}
+ retURL=%2F{!Lead.id}

2 Answers 2

1

You should be able to accomplish this just by using multiple page layouts. You don't need any Visualforce, Apex Code, or even a custom button. Simply create multiple layouts with the Record Type field set to either read-only or simply not on the page to cause records of certain type, per profile, to allow or disallow changing the record type. Record types are incredibly powerful, and this answer suggests that you consider using the native features available before trying to create custom buttons.

1
  • yea, I had already presented that solution, but that's not what they want. Aug 26, 2013 at 10:30
0

I think the best bet for solving this is to use the pattern of invoking Apex code via a Visualforce page that simply invokes an action and redirects.

It works like this:

Custom Button 
|--> Visualforce Page
     |--> <apex:page action="myAction" .../>
          |--> in controller or extension
               public PageReference myAction(){...do something and then redirect...}

There is a blog post on developer.force.com about this.

I know you said, "no Visualforce", but in this use case, the Visualforce is invisible to the end user except as a place to display any errors or problems. So you are not replacing anything in the standard page layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.