parent name dropdown remove options in record list view

Hi All,

                   I want to remove the parent_type options(parent_type_display-drop down list)  and display only Account 

in the parent type[Relate To field] of calls.

                    I was successful in the create and record view.But facing issues in the record list view(list view of calls).

                  Can any one help me out with this.

Regards

Sidhu

Tevfik Tümer Shijin Krishna Ramana Raju Santhana Ajay Kumar 

  • Hi All,

                   This is what i have done in the create and records views


    initialize: function(options) {
    this._super('initialize', [options]);

    this.hideDropdownValues();//function in intialize

    },

    hideDropdownValues: function(){

    var parent_list = app.lang.getAppListStrings('parent_type_display');

    Object.keys(parent_list).forEach(function(key) {
    console.log(parent_list[key]);
    if(parent_list[key].match(/Projects/) || parent_list[key].match(/Account/)){
    //do nothing
    }
    else
    {
    delete parent_list[key];
    }
    });
    this.model.fields['parent_name'].options = parent_list;

    },

    But failing badly in the record list 

    Regards

    Sidhu

  • Hi sidhu sidhu

    May i know the code.. how and where you are writing code for record list.

    Best Regards

    S Ramana Raju

  • Hi Ramana Raju Santhana

               In the recordlist file initialize i have put the event

     this.events['click [name=edit_button]'] = 'edit_button';

    and then i have called the 

    edit_button:function(){

    alert('edit button')
    var parent_list = app.lang.getAppListStrings('parent_type_display');

    Object.keys(parent_list).forEach(function(key) {
    console.log(parent_list[key]);
    if(parent_list[key].match(/Projects/) || parent_list[key].match(/Account/)){
    //do nothing
    }
    else
    {
    delete parent_list[key];
    }
    });
    model.fields['parent_name'].options = parent_list;



    },

    I have also tried using dependancies

    $dependencies['Calls']['so_parent_type'] = array(
    'hooks' => array("edit","save"),
    'trigger' => 'true',
    //'triggerFields' => array('parent_name'),//also changed to parent_type
    'onload' => true,
    'actions' => array(
    array(
    'name' => 'SetOptions',
    'params' => array(
    'target' => 'parent_type',//also changed to parent_type
    'keys' => 'getDropdownKeySet("forActivities_list")',
    'labels' => 'getDropdownValueSet("forActivities_list")'
    ),
    ),
    ),
    );

  • Hi All,

             Finally succeeded

    initialize function(RecordList.js):

    this.context.on('list:editrow:fire',this.testlistbuttonFunc1,this); 

    testlistbuttonFunc1:function(){
    var parent_list = app.lang.getAppListStrings('parent_type_display');
    Object.keys(parent_list).forEach(function(key) {
    if(parent_list[key].match(/Projects/) || parent_list[key].match(/Account/)){

    }
    else
    {
    delete parent_list[key];
    }
    });
    _.each(this.fields, function (field) {
    if(field.name == "parent_name")
    {
    //console.log('BEFORE '+field);
    field.def.options = parent_list;
    //console.log('AFTER '+field);
    }
    }, this);

    },