I need to get a field from a module and set the value of this field on the name field when I'm creating a new record. For example, in a custom module, we have a field called "work product", when we are creating a new record in subpanel module we want to show the consecutive value (from our custom module) on the work product field.
Below is the code :
({ extendsFrom: 'CreateView', initialize: function (options) { this._super('initialize', [options]); this.on('render', _.bind(this.onload_function, this)); }, onload_function: function () { var parent_model = App.controller.context.get('model'); var parentId = parent_model.get('id'); // It will get parent record id var parentname = parent_model.get('_module'); // It will get parent record name alert(parentId);alert(parentname); if(parentname == 'GD_Group_Design') { var parent_wp = App.controller.context.get('model').get('m03_work_product_gd_group_design_1_name'); alert('parent_wp ' + parent_wp); this.model.set('m03_work_product_taskd_task_design_1_name',parent_wp); //a simple set statement takes care of selecting the option on the dropdown } }, })
Although i am getting the field value from parent module but it's showing the below error when i am trying to create new record from subpanel view using + button .
this.context.parent.get(...).get is not a function at ....