In the "Call" entity, I created a "contact" field.
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?
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