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
ChubbyChubby 

How to make a field manual entry for group of users

Hi All,

I have a requirement where I need a field to be manual entry for some set of users. In the existing functioanlty the field is Auto populate through Apex calculation. Any suggestions appreciated.

Thanks in Advance.
Jainam ContractorJainam Contractor
Hi,

On what basis you are distinguishing those set of users..??? If it profile based then in the APEX code, you can add the filter criteria to exclude those set of users from the Calculation.

For eg: If it is profile based then you want to exclude users with Profile named 'Sales Rep' then you can use the below code line:
 
List<Profile> PROFILE = [SELECT Id, Name FROM Profile WHERE Id=:userinfo.getProfileId() LIMIT 1];
String MyProflieName = PROFILE[0].Name;
IF(MyProflieName != 'Sales Rep'){
    //your code here
}
If the set of user is not the current user then you can fetch those user id by some mean and make appropriate changes in the code

Try this and let me know if it works.

Please mark this as the solution if it helped your purpose.

Thanks,
Jainam Contractor,
Salesforce Consultant,
Varasi LLC
www.varasi.com
 
ChubbyChubby
Hi Jainam,
We are not distuiguishing users on profile basis because each user has different profiles and we don't want to hard code users.
Please suggest in that way.

Thank you.
Jainam ContractorJainam Contractor
Hi,

If there is no basis for distinguishing users, then how can we code differently. There is no such way.. Or you can add some checkbox field or something on the user object and make that as the base. So that way you can filter those users.

If you don't want to hard code you can use custom labels but before that you need to define some criteria/ something for distinguishing such users.

Thanks,
Jainam Contractor
ChubbyChubby
Hi,

I got some solution from one blog saying we can create hirarchy custom setting and add all the users, check the custom setting value in apex. any idea how can we do this? I am checking this way.

Thanks.