If you wish to restrict users to edit a record after for example, the case is marked as “Closed” or something similar kind, you have reached to a right place.
As mentioned above, today’s task is to stop users to editing any detail of an case after the Stage is “Closed”.
Here we go!
Note :
In this blog post, we are using SugarCRM’s OOB module Cases, if you wish to implement same functionality to your custom module, just make sure you are accessing right directory.
Steps are as below,
Step 1: Copy modules/<desired_module>/controller.php if exists, and paste it to custom/modules/<desired_module> or else create a file under custom/modules/<desired_module>/controller.php
Step 2: Write following code in there
<?php
class <desired_module>Controller extends SugarController {
function action_editview() {
if ($this->bean->status == "Closed") {
$this->view = 'noaccess';
}
else
$this->view = 'edit';
}
}
?>
Note :
Here, <desired_module> means the module name you see in the URL, for example, Contacts, Leads, etc.
Hope you find this blog post helpful.
Feel free to add comments and queries, that helps us to improve the quality of posts.
You can contact us at [email protected]
Thank you.