Hello, tell me how to configure the autocomplete fields when creating an object through another object:
How to configure auto-complete fields when creating an object through another object?
Collapse
X
-
Hello
in custom clientDefs of entity define createAction and view, extends views/record/panels/relationship, like custom/Espo/Custom/Resources/metadata/clientDefs/Account.json
Code:{ "relationshipPanels": { "opportunities": { "createAction":"createRelatedOpportunity", "view":"custom:views/account/record/panels/opportunities" } } }
Code:actionCreateRelatedOpportunity: function () { this.notify('Loading...'); var viewName = this.getMetadata().get('clientDefs.Opportunity.modalViews.edit') || 'views/modals/edit'; var attributes = {}; // <=== here set field values this.createView('quickCreate', viewName, { scope: 'Opportunity', relate: { model: this.model, link: 'account', }, attributes: attributes, }, function (view) { view.render(); view.notify(false); this.listenToOnce(view, 'after:save', function () { this.collection.fetch(); }, this); }, this); }, });
Last edited by tanya; 11-03-2017, 03:11 PM. -
I did this, gives an error, the card does not load ...
Code:Espo.define('custom:views/account/record/panels/opportunities', 'views/modals/edit', function (Dep) { return Dep.extend({ actionCreateRelatedOpportunity: function () { this.notify('Loading...'); var viewName = this.getMetadata().get('clientDefs.Opportunity.modalViews.edit') || 'views/modals/edit'; var attributes = {}; // <=== here set field values this.createView('quickCreate', viewName, { scope: 'Opportunity', relate: { model: this.model, link: 'account', }, attributes: attributes, }, function (view) { view.render(); view.notify(false); this.listenToOnce(view, 'after:save', function () { this.collection.fetch(); }, this); }, this); }, }); });
The error is this:
espo.min.js?r=1510035457:17 Uncaught (in promise) TypeError: Cannot read property 'split' of undefinedComment
Comment