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
TheLearnerTheLearner 

Restricting the profile based ont picklist values

Hi Experts,

I need to write validaton rule for this scenario, Could you help me please

If profile='SCC Procurement' user select the Organisation_Type__c='Supplier' then we need to provide Read and Edit access for that profile user, if the user selects the Organisation_Type__c !='Supplier' then we need to Provide only Read access and if he try to edit the record we need to provide error msg . could anyone help me please
Andy BoettcherAndy Boettcher
This is a perfect use case for RecordTypes - instead of "Organization_Type__c" being a picklist, make them RecordTypes.  You can restrict page layout readonly settings on a field by field basis this way.

That will work with ZERO CODE.  

If you are not willing to go that way, you will either need to make a LOT of validation rules (one per field) or some Apex to enforce that.
TheLearnerTheLearner
Hi Andy,

Could you guide me how to achieve this with record type please.
Andy BoettcherAndy Boettcher
Salesforce has some great documentation on Record Types:  https://help.salesforce.com/HTViewHelpDoc?id=customize_recordtype.htm

Read through the help documentation and give it a try.
TheLearnerTheLearner
Hi Andy,

I will work on record type but how can i display custom message to the user, when the user trying to edit the record where Orgnisation Type is not Supplier.
Andy BoettcherAndy Boettcher
You can create a formula field on the object that displays an image or message and place it right at the top of the page layout to communicate this to your users.  You can assign different page layouts per record type per profile.
TheLearnerTheLearner
HI Andy,

But already there is dafault page layout has been assigned to it, so how can i assign one more pagelayout to, im quite confusing , what need to do 
Andy BoettcherAndy Boettcher
Read through the Record Type help documentation and you'll see what I'm talking about.  You can assign a page layout PER RECORD TYPE to a profile.