+ Start a Discussion
arasuarasu 

How can I disable edit on a record if it is already in a specific status?

Hi,
 
We have the following two custom objects:
1. Purchase_Orders and
2. purchase_items.
 
The object Purchase_Orders has a custom text field named "Approval Status". The requirement is that once the value of the field "Approval Status" is "Approved", users (except system administrators) SHOULD NOT be able to EDIT the record for both the purchase_order and the purchase_item. Until then they are allowed to edit the detail pages for these records.
 
What are the different options to enable this kind of functionality to disable "EDIT" based on certain criteria? Can we do this using any standard force.com functionalities?
 
Appreciate all your feedbacks on this.
Thanks and regards,
Ambili
 
P.S:(We cannot use the standard salesforce approval process due to some inherent restrictions, therefore cannot use its locking mechanism.)
 
heatherwebsterheatherwebster
I did something like this using standard SF functionality.  I haven't applied it to VF so not sure if this will work - if anything it's a suggestion.
 
I created a field update to signify a locked opportunity and then I used a validation rule to only allow one user to edit those opportunities that were locked. My suggestion to you would be create a field update that is checked as locked when the status equals a certain stage.  Then create a validation rule that will prevent the editing of the record when the stage is locked.  The only issue you may run into is the user can still click on the edit page and see fields to populate, but will not be able to save the record when they click Save.  (Using the standard functionality I was able to utilize two record types and page layouts so the locked record didn't display editable fields.)
 
Validation Rule - you can change it to be the User Profile vs User
AND(Rx_Locked__c = true,
NOT ( $User.Id ="00540000000sDwt"))
 
Hope this helps,
Heather
arasuarasu
Hi Heather,
 
Thanks a lot for your response. I think this a very good alternative.
 
Thanks and regards,
Ambili