In the "Call" entity, I created a "contact" field.
This field is linked to the "Contact" entity.
![image.png Click image for larger version
Name: image.png
Views: 481
Size: 16.0 KB
ID: 88536](filedata/fetch?id=88536&d=1677588705&type=medium)
Currently, when I click on the select button, I open the modal window that lists all the contacts of the "Contact" entity :
![image.png Click image for larger version
Name: image.png
Views: 330
Size: 58.2 KB
ID: 88538](filedata/fetch?id=88538&d=1677588882&type=large)
But I would like, when I click on the select button of the field, to open the modal select-record window, already filtering on the name entered in the contact field (if it is empty, the window lists all the contacts as at present) like this :
I created a custom view select-record.js, called in Contact.json.
Looking at the forum, I tried to set up two functions to perform this filter based on the "contact" field of the entity Call.
getSelectFilters: function () {
let userName = this.model.get('contactId');
if (userName) {
return {
contact': {
type: 'equals',
value: userName,
data: {
type: 'is',
nameValue: this.model.get('contactName'),
},
}
};
}
return null;
},
getCreateAttributes: function () {
if (this.model.get('contactId')) {
return {
contactId: this.model.get('contactId'),
contactName: this.model.get('contactName'),
}
}
return null;
},
But it doesn't work, no filter is applied. Do you have a clue?
This field is linked to the "Contact" entity.
Currently, when I click on the select button, I open the modal window that lists all the contacts of the "Contact" entity :
But I would like, when I click on the select button of the field, to open the modal select-record window, already filtering on the name entered in the contact field (if it is empty, the window lists all the contacts as at present) like this :
I created a custom view select-record.js, called in Contact.json.
Looking at the forum, I tried to set up two functions to perform this filter based on the "contact" field of the entity Call.
getSelectFilters: function () {
let userName = this.model.get('contactId');
if (userName) {
return {
contact': {
type: 'equals',
value: userName,
data: {
type: 'is',
nameValue: this.model.get('contactName'),
},
}
};
}
return null;
},
getCreateAttributes: function () {
if (this.model.get('contactId')) {
return {
contactId: this.model.get('contactId'),
contactName: this.model.get('contactName'),
}
}
return null;
},
But it doesn't work, no filter is applied. Do you have a clue?
Comment