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
K_devK_dev 

How to lock the fields after an update

AND(ISCHANGED( Provider_City__c ) || 
ISCHANGED( Provider_Country__c ) || 
ISCHANGED( Provider_State__c ) || 
ISCHANGED( Provider_Street__c ) || 
ISCHANGED( Provider_zip_postal_code__c ), $User.Id <> '005i0000001jkrK')

 
I need this validation to fire after first update is done. That means if anyone wants to change these for the second time these fields must be locked.
 
CAn you please check the possibility created date or last modified also not working because they will change other fields on the same record.
Vinita_SFDCVinita_SFDC

Hello,

 

You can achieve this with validation rules. Create a custom field and update it with field update, which will happen when some field is updated in the record.

 

In the validation rule make a check on this custom field, if it has expected value then show error.

Deepa.B.AnkaliDeepa.B.Ankali
Create a Read Only recordtype and create a workflow rules that changes the record type to ‘Read Only’ if last modified date is not equal to created date.
Anil KamisettyAnil Kamisetty
Hi Dev

Your need was not clear, but here is the understanding. Existing Address (if filled in) cannot be modified. But the Address should be filled in for the first time (New record or Modified Record). Validation Rule throws up an error when the condition is True, hence you should create false conditions.

In your condition, the True between Address / State / Zip etc is making it fail. None should be allowed to be modified.

Here are the valid scenarios.
1. When the Address is being filled in for the first time, length of previous value of the address fields is Zero (new or modified record) (LEN(PRIORVALUE(Provider_City__c)) + LEN(PRIORVALUE(Provider_Country__c)) + LEN(PRIORVALUE(Provider_State__c)) + LEN(PRIORVALUE(Provider_Street__c)) + LEN(PRIORVALUE(Provider_zip_postal_code__c)) >0)
2. When the Address is being modified, it should be checked to ensure none of the address fields are getting modified (and condition between the various fields)

For the validation purposes, See the following should work.

AND(
(LEN(PRIORVALUE(Provider_City__c)) + LEN(PRIORVALUE(Provider_Country__c)) + LEN(PRIORVALUE(Provider_State__c)) + LEN(PRIORVALUE(Provider_Street__c)) + LEN(PRIORVALUE(Provider_zip_postal_code__c)))>0
,
OR(ISCHANGED( Provider_City__c ),ISCHANGED( Provider_Country__c ),ISCHANGED( Provider_State__c ),ISCHANGED( Provider_Street__c ),ISCHANGED( Provider_zip_postal_code__c ))
)

Above condition should work in all the below situations.
1. Address is filled in for the first time (Output : False, validation rule : Pass)
2. Existing Address is modifiet (Output : True, Validation Rule : Fail and will throw up an error)

Regards
Anil Kamisetty

Note : If this helps, please mark this as answer. If Possible, fill in the right validation rule used. Others do get benefited too.