Skip to main content
6 votes
Accepted

How does Read-Only field level security affects Apex and Workflows

Apex and Workflows function independently of field level security; see the documentation for considerations for workflows and Field level security. So Apex code and workflows will be able to read and ...
user254875486's user avatar
5 votes

System.FinalException: Collection is read-only - Apex Class

Add the records to a separate list, and return that whether or not there is a controller. I find it significantly improves your API to never return a null collection. Also, you should take advantage ...
Adrian Larson's user avatar
  • 150k
4 votes
Accepted

How to make <apex:inputText> field conditionally read-only without Javascript

For normal apex:inputText fields, use the disabled attribute: <apex:inputText disabled="{!makeItReadOnly}" value="{!foo}"/>
sfdcfox's user avatar
  • 495k
4 votes
Accepted

Specify read only fields for lightning:recordForm

You won't be able to make a field read only specifically while using lightning:recordForm. It's either all fields or none which you could display as read only depending on the mode selected. The ...
Jayant Das's user avatar
  • 30.6k
3 votes
Accepted

Can't disable "Edit Read Only Fields" permission for system administrator

The System Permissions assigned to standard profiles are not editable. If you need to edit them, instead, clone the profile and make the changes there. Then, assign your users to the cloned profile ...
David Reed's user avatar
  • 93.2k
3 votes

can a user edit the value of the field through apex which are read only field on layout in salesforce?

Yes, I've used this technique myself. The "read-only" flag on a page layout is only enforced when using the "save" button on the layout. Alternatively, you could make a formula field that pulls data ...
Derek F's user avatar
  • 62.4k
3 votes
Accepted

How to toggle off sforce.connection.update DML updates in a visualforce readOnly page?

The readOnly attribute only prevents Apex code on the page from performing any DML, in exchange for higher governor limits (1,000,000 query rows). The sforce.connection script uses the API directly, ...
sfdcfox's user avatar
  • 495k
3 votes
Accepted

Copy read-only object received from parent component

The answer is to use a setter: _filter; @api set filter(value) { this._filter = {...value}; } get filter(value) { return this._filter; } You can then use _filter as you like. Note that this is ...
sfdcfox's user avatar
  • 495k
2 votes
Accepted

Update two records of one type when a single record is triggered

From your description, I believe you have two options. One option would be to query for the 2nd record and update it in an @future method. The 2nd option would be to change the trigger to an ...
crmprogdev's user avatar
2 votes

Prevent users from editing old contacts

Possible ways to achieve this are: Trigger Or Validation rule. You can create a trigger on(before update) contact that if checkbox is checked show error through addError method. Or simply from ...
Mr.Frodo's user avatar
  • 5,802
2 votes

Edit read-only Account fields without a single line of apex or VF page code

Only Trigger or APEX code can run on system mode and override the CRUD settings. To achieve this requirement you need some custom code not possible only through configuration.
Avijit Chakraborty's user avatar
2 votes
Accepted

How to make accounts read-only / locked?

It really depends on what you need to do and what your restrictions are. Without knowing any more, I'd recommend the following Create a new Account Record Type, call it "Read Only" (or whatever) ...
Sebastian Kessel's user avatar
2 votes

make a field read only

Two ways you can do that. Option 1) Create a separate recordtype and page layout and update the recordtype based on the checkbox value selection. Need to write a workflow field update to update ...
Santanu Boral's user avatar
2 votes
Accepted

Record is Read Only on After Insert Method

The issue is in this for loop for (Product2 product : newMap.values()) { Accounting_Unit__c unit = units.get(product.Product_LOB__c); if (unit != null) { // This is the line that ...
Derek F's user avatar
  • 62.4k
2 votes
Accepted

How to create a 100% Read-Only profile in Salesforce (including 'Salesforce objects' as shown in DataLoader)?

Unfortunately, there are no individual object permissions you can assign to Share, History, Tag, etc objects. You won't be able to remove those objects, because security is controlled by the parent ...
sfdcfox's user avatar
  • 495k
2 votes
Accepted

Issues with List API in Read Only mode VF page

Child records are limited to about 2,000 unless you iterate over all of them in your Apex Code first. This happens because the sub-query needs its own QueryLocator. You'd probably have better luck ...
sfdcfox's user avatar
  • 495k
2 votes
Accepted

How to mark a field as readonly when we clone a record?

Another possible way to accomplish this is to use a validation rule. While validation rules are not well suited to handle things of the form "prevent all fields from being edited except for fields x, ...
Derek F's user avatar
  • 62.4k
2 votes

How to mark a field as readonly when we clone a record?

One way I can think of to accomplish this would be to assign a different recordtype to the cloned record. With the different recordtype, you can associate a new page layout to it (one that has your ...
Derek F's user avatar
  • 62.4k
2 votes

Way to assign read only to ALL fields at once?

Other than using code to generate permission set data (which is possible - iterate the schema and generate the required XML as a string which you debug log out; run the code, copy and paste the XML ...
Phil W's user avatar
  • 36.8k
2 votes
Accepted

Any limit for map collection size for ReadOnly page

The only practical limits to how much you can display are Heap Size and CPU Time, as I answered here. I was able to populate a Map with over one million records and Visualforce allowed the collection ...
Adrian Larson's user avatar
  • 150k
2 votes

LWC iterating over a loop from apex is not let me change the data

JavaScript has a Set class, which is like an Array, but must contain unique values. Converting an array to a set and back to an array will remove duplicate values. this.myData = new Array(new Set(this....
Chuck's user avatar
  • 967
1 vote

can a user edit the value of the field through apex which are read only field on layout in salesforce?

I want some fields to be updatable from apex only and want those fields as read-only on layouts for all users. Can I do it by making fields as read-only on layout? Mostly YES - the read only ...
cropredy's user avatar
  • 71.9k
1 vote
Accepted

Set Dynamic value for an readOnly field- Case Number

You can coerce a value into a readonly field using JSON.deserialize System.debug(LoggingLevel.INFO, (Case)JSON.deserialize('{"CaseNumber":"123"}',Case.class)); produces an SObject of ...
cropredy's user avatar
  • 71.9k
1 vote
Accepted

SyncedQuote field is read only within a trigger

Got it resolved with following workaround. Created below 2 methods, private static String populateOppSelectAllFields(Map<String, Schema.SObjectField> fldObjMap) { List<Schema....
Pasan Eeriyagama's user avatar
1 vote

Specify read only fields for lightning:recordForm

Are you using the Fields / layoutType attributes for displaying the Fields . My suggestion would be to take out Status field from the above fields/Layout and display it using lightning:outputField. ...
Ajinkya Phadnis's user avatar
1 vote
Accepted

Use trigger to prevent the System Administrator from editing a field, but still allow Apex code to edit it

By doing this, you are binding your hands for future changes to your processes, such as bulk data loads or restores from backup. If you are set, however, on making this field Apex-only, you can use ...
David Reed's user avatar
  • 93.2k
1 vote

lightning:combobox readonly atrribute is not working

As you can read on this reply a good Idea could be use the disabled attribute. readonly is only available in Summer '18 (v43.0). Note that it doesn't seem to work anyways, so you'll probably ...
Martin Larizzate's user avatar
1 vote

Make an inputfield readonly depending on a controller boolean variable

You can use apex:outputPanel to render the input field. <apex:outputPanel rendered="{!show_read_write}"> <apex:inputField value="{!value}" /> </apex:outputPanel> <apex:...
Ankita's user avatar
  • 1,478
1 vote

Lightning: How to make related records read-only on page layouts?

One workaround I was able to employ is setting all fields as read-only on the compact layout for the update and/or create action.
Charles Naccio's user avatar
1 vote

Record is Read Only on After Insert Method

You are still adding the trigger context record to the insert list. You need an entirely new SObject instance. Your naming is also quite confusing with update prodsToInsert... For example: ...
Adrian Larson's user avatar
  • 150k

Only top scored, non community-wiki answers of a minimum length are eligible