Hiding signatures from received email replies in the ticket's comment field

Hello,
I have the following problem: when an admin responds to a ticket request, the user receives an email in Outlook with the corresponding response from the admin. When the user replies directly to this email in Outlook, the comment field of the respective ticket shows the user's reply along with their Outlook signature. This makes the comment thread in the ticket quite cluttered. How can I hide the signatures so that the user can still reply directly to ticket notifications via Outlook, but in the ticket's comment thread, only the actual message of the user is displayed without their signature? The comment field in the ticket form is generated by the HTML tag <comments/>.
I already tried it with the following code which I found online but it doesn't work.

fd.spRendered(function() {

var commentsField = document.querySelector('comments'); 

if (commentsField) {
    var emailContent = commentsField.innerHTML;

    function removeSignature(emailContent) {
       
        var signatureIndex = emailContent.indexOf('Freundliche Grüße'); 
        //'Freundliche Grüße' is the beginning of the signatures
        
        if (signatureIndex !== -1) {
            return emailContent.substring(0, signatureIndex).trim();
        }

        return emailContent;
    }

    var cleanEmailContent = removeSignature(emailContent);
    commentsField.innerHTML = cleanEmailContent;
}

});

Thanks, Yücel

Hello Yücel,

At present, signature removal functionality isn't available out of the box in HelpDesk. I have logged your query as a feature request - our developers may implement this at some point in a future version.

Hello Yücel! All ticket comments are stored in a 'Comments' list. A 'Body' column contains the HTML contents. You can create a Power Automate flow started on an item creation in the list. Then trim the string from the 'Body' field as you wish and then update the same item with the result you have. Will such an approach work for you? It is much simpler than custom JS in Forms and quicker than waiting for the feature implementation.

Hello Evgeniy,
could you please explain this in more detail? I’m not quite sure what and how exactly I need to do.

All comments are stored in the 'Comments' list:

The 'Body' column contains HTML of the comments added to tickets:

Create a flow started on an item creation in the 'Comments' list, modify the value of the 'Body' field using Power Automate expressions and update the same item using the trimmed body.