Fixing the Infor CRM Web Email Control to Handle Single Quotes

In the Infor CRM client for all levels of 8.3 and 8.4 if you have an email control that contains an email like “phil.d’angelo@gmail.com’ the email address is not correctly used to open a new email dialog. Instead the email that gets passed is “pil.d”.

This is because the launching of the email window uses client side code to call the standard mailto function. The email in the email widget in javascript is returned HTML encoded. When the client side call to mailto is made is passes this encoded string.

Lets take a look at how to fix it.

This code can be used in conjunction with Ryan’s awesome Custom Loader in a single new module.

define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'Sage/UI/Controls/Email'
],
    function (declare, lang, ActivityEditor) {

        function initializeWorkingEmail() {
            lang.extend(Sage.UI.Controls.Email, {
                sendEmail: function () {
                    var email = this.email;                                       
                    //This is a custom function to decode the html encoded email value
                    var decodeHTML = function (str) {
                        return str.replace(/&#(\d+);/g, function (match, dec) {
                            return String.fromCharCode(dec);
                        });
                    };
                    //The decoded value is passed in the mailto
                    email = email = "mailto:" + decodeHTML(email);
                    document.location.href = email;                    
                }
            });
        }

        // run customizations 
        initializeWorkingEmail();
    });
ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!