restrict editview in a sidecar module under certain conditions

Hi,

I have a field in accounts module, when this field change to "Closed" status, i need to allow the editview's record only for the assigned user, and restrict to the other users. How can i do that without roles in SugarCRM 7.6?

Thanks for your help.

Parents
  • Hi Oscar,

    The best way I can think to do this is to use a Dynamic Record View combined with making use of this.noEditFields. If you have any trouble with either of these, please let me know and I'd be happy to help you get the code working.

    -Alan

  • Oscar,

    I tested this and was actually able to get it to work without needing the Dynamic Record View. I created the below file, ran a Quick Repair, and it worked as expected. Let me know if you have any questions about getting it to work!

    // custom/modules/Accounts/clients/base/views/record/record.js
    ({
        extendsFrom:'RecordView',
        initialize:function(options){
            this.plugins=_.union(this.plugins||[],['HistoricalSummary']);
            this._super('initialize',[options]);
        },
        _buildGridsFromPanelsMetadata:function(panels){
            var noEditFields = new Array();
            this._super('_buildGridsFromPanelsMetadata',[panels]);
            if(this.model.get('status_c') == 'Closed') {
                for(field in this.model.fields) {
                    noEditFields.push(field);
                }
                this.noEditFields=noEditFields;
            }
        },
    })
    

    -Alan

  • Hi Alan,

    Thanks a lot, worked like a charm, but i have a question, what is the purpose of '_buildGridsFromPanelsMetadata'?

Reply Children
No Data