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
rakeshrockb123rakeshrockb123 

Change the access to filed once custom buttom is clicked

HI,

I'm working on a requirement, where sales users can edit the field until users from other profile click the custom buttom called "approved to legal", once the button is clicked, sales users can no more edit the field (read only). 

 

I appreciate your ideas .......

 

Thanks,

Rocky

Rajesh ShahRajesh Shah
You can have to record types and 2 corresponding page layouts. In 1 page layout, define the field as editable while in other define it as read only. When the user clicks on Approved to Legal, change the record type which would change the page layout. The field would then be read only.
rakeshrockb123rakeshrockb123

Thanks rajesh, but how to make it dynamic, ie " when user clicks the buttoin" how should i capture?..

 

 

Rajesh ShahRajesh Shah
One option is to use OnClick javascript attached to the custom button. When the button is clicked, it calls JS which then calls a Apex Class. Apex class makes the update in record type and the JS then refreshes the detail page.