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
PrakkiPrakki 

How to change custom object fileds to read only based on check box filed in the user object

Dear All,

 

I am strggling to solve this scenario, if any one helping me on this i will be greatful to them.

 

We are having various users and an custom object called Vehicle it containing many pick list fields, some text fields too currently all the users having modify all permission on this object. In the user object we had created a check box filed.

If the check box in the user object is unchecked, users should not enter any values to the pick list filed, means for all the users Vehicle object pick list fields should changed to read only. I would like to clear only picklist fields should be read only, on remaining fields user can do any operation.

 

If check box is checked then modify all permission on the vehicle object should effect. 

 

It's very urgent,

 

Thank you.

 

Regards,
Prakki

Chris760Chris760

Consult the "Controlling Access To Fields" section of your handbook: http://www.salesforce.com/us/developer/docs/fundamentals/index_Left.htm#CSHID=adg_securing_data_control_access_fields.htm|StartTopic=Content%2Fadg_securing_data_control_access_fields.htm|SkinName=webhelp

 

There's no easy way to do it with a "checkbox" on the user object, unless you want to write validation rules for every field on the object.  Instead, you can make two profiles: one where the employee has visible access (read/write if you set that permission for their profile) and one that's read only, and just change the profile for the person instead of clicking a checkbox.

 

If you insist on writing a validation rule for every field that you want to restrict access to using your checkbox idea, then consult the "Introducing Validation Rules" section of your handbook: http://www.salesforce.com/us/developer/docs/fundamentals/index_Left.htm#CSHID=adg_simple_app_adv_validation_rules.htm|StartTopic=Content%2Fadg_simple_app_adv_validation_rules.htm|SkinName=webhelp

 

Cheers

PrakkiPrakki
Dear Chris,

I hope validation rules does't restrict user to add new values to the pick list filed from the object field level.

As per the scenario we should restrict users to not to add values to all the pick list fields. That means all the pick list fields should be a read only fields to all the users, if check box is unchecked.

Regards,
Prakki
Chris760Chris760

You would be creating two custom profiles.  One where the user only has "View" permissions for that object, and one where the user also had "Edit" permissions.  Then instead of a checkbox on the user object, you just edit the picklist value on the user object that says "Profile" and select the profile you made with "View" permissions only, instead of the profile that has "View" and "Edit" selected.

PrakkiPrakki
Yes Chris,

We can do like that, i had suggested the same thing to my client also. But he is insisting us to follow his way.

Can you please let me know like, are we able to override current profile permissions with help of any concept like Apex or Triggers or Dynamic apex etc..

If yes.. how to do that..??

Thank you.
Prakki