Removing email signature from issue
Hi all,
I've been struggling a lot with the workflow editor (and the limitations of the workflow editor language) today.
Our issues are created from email conversations and I want to remove all signatures from the issue description to improve readability. Basically I want to remove all substrings starting with "Best regards" and ending with "From:" (which is where the next email in the conversation begins)
The following is working, but it only works if there is only 1 signature in the email conversation:
rule stripEmailSignature
when issue.State == ({Submitted}) {
var bestRegardsIdx = issue.description.indexOf("Best regards", opts);
if (bestRegardsIdx > 0) {
issue.description = issue.description.substring(0, bestRegardsIdx);
}
}
I also tried looking at the rest API as an alternative, but there were no operations for updating the description of an issue.
I've been struggling a lot with the workflow editor (and the limitations of the workflow editor language) today.
Our issues are created from email conversations and I want to remove all signatures from the issue description to improve readability. Basically I want to remove all substrings starting with "Best regards" and ending with "From:" (which is where the next email in the conversation begins)
The following is working, but it only works if there is only 1 signature in the email conversation:
rule stripEmailSignature
when issue.State == ({Submitted}) {
var bestRegardsIdx = issue.description.indexOf("Best regards", opts);
if (bestRegardsIdx > 0) {
issue.description = issue.description.substring(0, bestRegardsIdx);
}
}
I also tried looking at the rest API as an alternative, but there were no operations for updating the description of an issue.
Please sign in to leave a comment.
Am I correct with that, curretnly after first signature found in description, all the rest email's body drops?
Also, please clarify how do you get several signatures in one message? Is it the case when you reply the original request by email and add sevearl extra addresses in that replay? In common case, all direct replies should become a comments of the issue.
I assume that, you can find the '–' instead of 'Best regards' , as the start of signature, and remove it till the empty string before the next message body.
sorry, my question wasn't very clearly formulated. Let me clarify.
I have set up mailbox integration, such that clients can create issues by sending an email to an email address. Usually someone from our organization forwards an email sent from a client to this email address, and because of this, there are often several signatures in the body of the email, and thus also in the created issue description. The signatures make the issue description less readable and I simply want to remove all occurences of signatures from the description. If I were to write this code in java or c# it wouldn't be an issue (looking up the signature substrings using regular expressions and removing them), but the workflow editor language seems very limited.