based on status how to remove edit option

How can i remove “Edit” link option from "Quotes List view & Detail View " for status = Closed Accepted in Quotes module ?

based on role i am able to remove edit option from List view and Details view like only Accounts’ people and admin can edit quotes . but based on status can we remove the same

can some one please guide me how we can achieve this

Thank you for your time


For the detail view you will have to create a custom view.detail.php which will evaluate the value for the status.
If the current record can not be edited, according to staus value, you can remove the button “Edit” from layout on the fly:


if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');


class ModuleNameViewDetail extends ViewDetail {
    function display() {
        if($this->bean->field_name == 'some_value') {
        echo $this->dv->display();

Replace the strings “ModuleName”, “field_name”, “some_value” with the appropriate values.

As for the listview that may be a bit more difficult.

Check out this thread :

1 Like

i tried to implement this my code is like this

<?php if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); require_once('include/MVC/View/views/view.detail.php'); class AOS_QuotesViewList extends ViewList{ function Display() { if($this->bean->stage == 'Closed Accepted'){ unset($this->dv->defs['templateMeta']['form']['buttons'][0]); } $this->dv->process(); echo $this->dv->display(); } } but i am geting error like Fatal error: Call to a member function process() on a non-object in / can you help me on this ??

… maybe because you have included view.detail.php but you have extended viewList

than how can i solve this ?

ya it was silly mistake

now its calling process function but its giving
Missing argument 1,2,3 for ListViewSmarty::process(),

function process($file, $data, $htmlVar)

do we need to pass file name along with it ???


dosen’t unset the option so i include and hide the button ??

but why unset is not working

1 Like

did you fixed this question?

just as a note: even if you remove the button, people will still be able to edit the record (e.g. changing the Url from action=DetailView to action=EditView) -> it’s just “eye candy”, not a security measure.