11
November

0 Comments | 0 Shares | Urdhva Tech

If you wish to restrict users to edit a record after for example, the Sales Stage is marked as "Closed Lost" 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 opportunity after the Sales Stage is "Closed Lost".

Here we go!


In this blog post, we are using SugarCRM's OOB module Opportunities, if you wish to implement same functionality to your custom module, just make sure you are accessing right directory.


Step 1: Copy modules/Opportunities/controller.php if exists, and paste it to custom/modules/Opportunities or else create a file under custom/modules/Opportunities/controller.php

Step 2: Write following code in there and voila!

<?php

class OpportunitiesController extends SugarController {

    function action_editview() {
        if ($this->bean->sales_stage == "Closed Lost") {
            $this->view = 'noaccess';
        }
        else
            $this->view = 'edit';
    }

}

Hope you find it helpful.

Feel free to leave your comments.
Download attachments:
Comments
  • No Comments Found.
Post your comment