Hey theBuzzyCoder
have managed to make it work, i am trying to do the same and want to use a dropdown to chose contact role when linking to an account but couldn't get it to work. Seems there is always a problem in the code. I was just wondering if you managed to make it work and if it would be ok for you to share how does it work.
Many thanks
Rabii
Announcement
Collapse
No announcement yet.
Define accountRole as Enum instead of varchar
Collapse
X
-
Hi tanya ,
This is what I have done. But still no use. Can you please tell me what exactly I have to change.
And I have looked and tried implementation given in the documentation before asking here!
Code:Espo.define('crm:views/contact/fields/account-role', 'views/fields/enum', function (Dep) { return Dep.extend({ setup: function () { Dep.prototype.setup.call(this); this.listenTo(this.model, 'change:title', function (model, value, o) { this.model.set('accountRole', this.model.get('title')); }, this); }, getAttributeList: function () { var list = Dep.prototype.getAttributeList.call(this); list.push('title'); return list; }, data: function () { var data = Dep.prototype.data.call(this); if (this.model.has('accountIsInactive')) { data.accountIsInactive = this.model.get('accountIsInactive'); } return data; } }); });
Last edited by theBuzzyCoder; 03-16-2018, 10:56 AM.
Leave a comment:
-
you have set temples... varchar templates
Leave a comment:
-
Thanks tanya .
This is not working. Is there anything else I need to do other than clear_cache and rebuild
espocrm/client/modules/crm/src/views/contact/fields/account-role.js
Code:Espo.define('crm:views/contact/fields/account-role', 'views/fields/enum', function (Dep) { return Dep.extend({ detailTemplate: 'crm:contact/fields/account-role/detail', listTemplate: 'crm:contact/fields/account-role/detail', setup: function () { Dep.prototype.setup.call(this); this.listenTo(this.model, 'change:title', function (model, value, o) { this.model.set('accountRole', this.model.get('title')); }, this); }, getAttributeList: function () { var list = Dep.prototype.getAttributeList.call(this); list.push('title'); return list; }, data: function () { var data = Dep.prototype.data.call(this); if (this.model.has('accountIsInactive')) { data.accountIsInactive = this.model.get('accountIsInactive'); } return data; } }); });
Code:{ "fields": { "accountRole": { "type": "enum", "notStorable": true, "options": [ "", "Type-A", "Type-B", "Type-C", "Type-D" ], "layoutMassUpdateDisabled": true, "layoutListDisabled": true, "layoutDetailDisabled": true, "view": "crm:views/contact/fields/account-role" } } }
Last edited by theBuzzyCoder; 03-16-2018, 10:06 AM.
Leave a comment:
-
Hi, "view": "crm:views/contact/fields/account-role" this view extends varchar field view. Change the view
check client/modules/crm/src/views/contact/fields/opportunity-role.js
Leave a comment:
-
Define accountRole as Enum instead of varchar
Hi,
I am trying to make accountRole (Title) as enum/drop down while linking an account.
This didn't work...
entityDefs/Contact.json
Code:{ "fields": { "accountRole": { "type": "enum", "required": true, "options": [ "", "Type-A", "Type-B", "Type-C", "Type-D" ], "notStorable": true, "layoutDetailDisabled": true, "layoutMassUpdateDisabled": true, "layoutFiltersDisabled": true, "exportDisabled": true, "importDisabled": true, "view": "crm:views/contact/fields/account-role" } } }
1 PhotoLast edited by theBuzzyCoder; 03-15-2018, 06:52 AM.
Leave a comment: