I have a custom entity which has a Many-to-One relationship with the Account Entity. My Account Entity has a custom enum of "type" where I have different kinds of accounts I am keeping track of (i.e. Vendor, Customer, Agency)
My custom entity has a link to the accounts where I'd like to select only accounts with the "type" of "Vendor". I've attached a screenshot of the select filter I'd like to have, but I'm not sure how to write it so that it works. I'm assuming it's something similar to what I'm working with already?
I have created a custom view: **This does not work.** \client\custom\src\views\currentProduct\field\vend or.js
Espo.define('custom:views/currentProduct/fields/vendor', 'views/fields/link', function (Dep) {
return Dep.extend({
getSelectFilters: function () {
return {
'account.type': {
type: 'anyOf',
value: 'Vendor',
valueName: this.model.get('accountName'),
}
};
}
});
});
I've attached the custom view in custom/Espo/Custom/Resources/metadata/entityDefs/CurrentProduct.json
{
"fields": {
"vendor": {
"type": "link",
"dynamicLogicVisible": null,
"view": "custom:views/contract/fields/product",
"required": false,
"audited": false,
"tooltip": false
}
},
"links": {
"vendor": {
"type": "belongsTo",
"foreign": "vendor",
"entity": "Account",
"audited": false,
"isCustom": true
}
}
}
My custom entity has a link to the accounts where I'd like to select only accounts with the "type" of "Vendor". I've attached a screenshot of the select filter I'd like to have, but I'm not sure how to write it so that it works. I'm assuming it's something similar to what I'm working with already?
I have created a custom view: **This does not work.** \client\custom\src\views\currentProduct\field\vend or.js
Espo.define('custom:views/currentProduct/fields/vendor', 'views/fields/link', function (Dep) {
return Dep.extend({
getSelectFilters: function () {
return {
'account.type': {
type: 'anyOf',
value: 'Vendor',
valueName: this.model.get('accountName'),
}
};
}
});
});
I've attached the custom view in custom/Espo/Custom/Resources/metadata/entityDefs/CurrentProduct.json
{
"fields": {
"vendor": {
"type": "link",
"dynamicLogicVisible": null,
"view": "custom:views/contract/fields/product",
"required": false,
"audited": false,
"tooltip": false
}
},
"links": {
"vendor": {
"type": "belongsTo",
"foreign": "vendor",
"entity": "Account",
"audited": false,
"isCustom": true
}
}
}
Comment