[SOLVED] How can I assign a labels trough Article filters #772
-
Hi everyone, I've tried by myself to make a Article filters that will assign a label when the I'm sure it will be something close to --> var whitelist = [
'test subject', 'blabla'
];
function filterMessage() {
if (whitelist.some(i => msg.title.indexOf(i) != -1)) {
msg.assignLabel(findLabelId('MyLabel'))
}
} But I can't figure it out. thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
I did almost the same thing and see that you missed |
Beta Was this translation helpful? Give feedback.
-
Your script is missing fundamental part, Fixed: var whitelist = [
'qt', 'abc'
];
function filterMessage() {
if (whitelist.some(i => msg.title.indexOf(i) != -1)) {
console.log("inside");
msg.assignLabel(msg.findLabelId('Test Test'))
}
return MessageObject.Accept;
} |
Beta Was this translation helpful? Give feedback.
Your script is missing fundamental part,
return
statement indicating whether message (modified) is actually accepted by the filter or not.Fixed: