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
ranga babu vangalapudi 2ranga babu vangalapudi 2 

how to restrict a user to edit a field only on friday

I want users to edit some particular field only on every friday,

For this i used following validation:

CASE( WEEKDAY(DATEVALUE(CreatedDate)),
2, ISCHANGED(Age_in_Years__c),
3, ISCHANGED(Age_in_Years__c),
4, ISCHANGED(Age_in_Years__c),
5, ISCHANGED(Age_in_Years__c),
NOT(ISCHANGED(Age_in_Years__c)))

but it is throwing an error: "Incorrect argument type for function 'CASE()'"

Can any one help me on this.

Thanks,
Ranga.V
Best Answer chosen by ranga babu vangalapudi 2
sfdc expert 3sfdc expert 3
Hi Ranga,

Please use the following Error Conditional formula Which will throw error if you are making changes to Age_in_Years__c field other than on Friday
AND( 
    ISCHANGED( Age_in_Years__c ), 
    WEEKDAY(TODAY()) <> 6
)

Thanks

All Answers

Jolly_BirdiJolly_Birdi
Hello @Ranga

Try this below code:

AND(WEEKDAY(DATEVALUE(CreatedDate))=6,ISCHANGED(Age_in_Years__c))

If you find it positive then mark it best answer.

Thanks,
Jolly Birdi
sfdc expert 3sfdc expert 3
Hi Ranga,

Please use the following Error Conditional formula Which will throw error if you are making changes to Age_in_Years__c field other than on Friday
AND( 
    ISCHANGED( Age_in_Years__c ), 
    WEEKDAY(TODAY()) <> 6
)

Thanks
This was selected as the best answer
Jolly_BirdiJolly_Birdi
Hello @Ranga

As per your subject that you want to restrict user for friday update, then the below Code will help you out for this.
 
AND( 
    ISCHANGED( Age_in_Years__c ), 
    WEEKDAY(TODAY()) = 6
)

 

Please mark this as best if it resolve your problem.

Thanks,
Jolly Birdi