0

I'm trying to set up a profile that can only change the Owner on a Lead, nothing else.

Mostly it works, except for three fields: Name, Lead Status and Company:

  • Field-level security won't let me set these to read-only (settings are not editable)
  • Can't make them read-only in page layout either (options are greyed out, with 'Required' checked and 'Read-only' unchecked)

In the Field Accessibility page the fields show as Editable with the explanation 'Field is editable because of page layout'.

Is there any way short of validation rules to make these fields not editable for a given profile?

  • I know you said no validation rules, but what's your opposition to them? I think they would work well for this purpose. – jackerman09 Sep 25 '12 at 17:17
  • Are you on Professional Edition? – Greg Grinberg Sep 25 '12 at 18:22
  • @jackerman09 validation rules still allow users to edit the field, and only prevent the save. Which I feel is a sub-optimal user experience. But it's a valid fall-back solution – Jelle van Geuns Sep 26 '12 at 23:13
  • @grigriforce No I'm on Enterprise Edition – Jelle van Geuns Sep 26 '12 at 23:17
2

I know you said no validation rules in your question, but based on your comments it seems like it's more of the aesthetics that's keeping you away from them. From personal experience, as long as you have a good error explanation that doesn't leave users confused, they have no problem with validation rules. In case you decide to go this route, here's a rule that may work for you.

AND($Profile.Name = 'Read-Only Profile', ISCHANGED(Lead_Status))

Error Message: Lead Status is a read-only field for users with the profile 'Read-Only Profile'

Hope this helps if you decide to use this.

2

Check out this link : http://salesforce-stuff.blogspot.com/2011/10/removing-save-new-button-and-other.html

The link shows in detail how to hide a field from the edit mode. Hopefully you can refactor the JS var x=document.getElementsByName("email");(assuming email field or get Id of the field from view source and getElementById) x.readonly = true;

I have not tested this but know siderow hack is an option

2

Using Visualforce, you can replace the default Edit page with your own page. For those fields, make sure that they are rendered as outputfield for the Profile in question:

<apex:outputfield value="{!Lead.Company}" rendered="{!($Profile.Name == 'Limited Profile Name')}" />
<apex:inputfield value="{!Lead.Company}" rendered="{!($Profile.Name != 'Limited Profile Name')}" />

For this purpose, you don't need any Apex, just a page.

  • I like the Visualforce idea, but you need to keep in mind that if you override the default page you can't (easily) set page layouts by record type. – Mike Chale Sep 27 '12 at 22:26
  • When u say using VF page and override the EDIT mode, just in case he needs to add more fields to the edit page will it not be redoing standard behavior of fields over again ?Even when it comes to replicating for other record types as mike pointed out how will you handle the request? – Rao Sep 27 '12 at 22:57
  • You're right, in a dynamic environment with multiple record types this becomes a headache to maintain. This only really works in the case that there's one page layout and it doesn't change much. Perhaps a separate Edit page just for the readonly user, called from a custom button? – Jeremy Nottingham Sep 27 '12 at 23:06
  • I like this solution as well; however, the edit page is only one entry point to the lead object. As a result, you won't block other ways for this user to change the fields you're trying to protect - it's security through obfuscation instead of true security. Validation rules or apex triggers as validation rules are the best way to handle this for all entry points including API or enhanced list views with inline edit. – Adam Torman Nov 30 '12 at 0:41

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.