Making Lookups in the Infor CRM History Dialog Hyperlinks

One thing that irks me about the dojo based Activity and History lookup widgets is that they don’t allow hyperlinking. While I get you don’t want users leaving the current page in the middle of creating a new record, it is awfully nice to be able to navigate to a record via a link.

I recently was asked to extend the History dialog so that the lookups acted as hyperlinks to the respective entities. I was able to achieve this by extending the base HistoryEditor widget and adding to the _setAccessToUI method. Here is the code:

define('FX/HistoryEditor', [
    'dojo/_base/declare',
    'Sage/UI/Controls/Lookup',
    'dijit/form/TextBox',
    'dijit/layout/ContentPane',
    'Sage/MainView/ActivityMgr/HistoryEditor',
    'dojo/on',
    'dojo/_base/lang'

],
function (declare, Lookup, TextBox, ContentPane, SageHistoryEditor,on, lang) {
    var editor = declare('FX.HistoryEditor', [SageHistoryEditor], {        
        _setAccessToUI: function (hasAccess) {
            this.inherited(arguments);
                        
            this.lup_Account.textbox.style.textDecoration = "underline";
            this.lup_Account.textbox.style.color = "Blue";
            on(this.lup_Account, 'dblclick', lang.hitch(this, function() {           
                var his = this._historyData;
                var url = 'Account.aspx?entityid=' + his.AccountId;
                window.location = url;
            }));

            this.lup_Contact.textbox.style.textDecoration = "underline";
            this.lup_Contact.textbox.style.color = "Blue";
            on(this.lup_Contact, 'dblclick', lang.hitch(this, function () {
                var his = this._historyData;
                var url = 'Contact.aspx?entityid=' + his.ContactId;
                window.location = url;
            }));

            this.lup_Ticket.textbox.style.textDecoration = "underline";
            this.lup_Ticket.textbox.style.color = "Blue";
            on(this.lup_Ticket, 'dblclick', lang.hitch(this, function () {
                var his = this._historyData;
                var url = 'Ticket.aspx?entityid=' + his.TicketId;
                window.location = url;
            }));

            this.lup_Lead.textbox.style.textDecoration = "underline";
            this.lup_Lead.textbox.style.color = "Blue";
            on(this.lup_Lead, 'dblclick', lang.hitch(this, function () {
                var his = this._historyData;
                var url = 'Lead.aspx?entityid=' + his.LeadId;
                window.location = url;
            }));

            this.lup_Opportunity.textbox.style.textDecoration = "underline";
            this.lup_Opportunity.textbox.style.color = "Blue";
            on(this.lup_Opportunity, 'dblclick', lang.hitch(this, function () {
                var his = this._historyData;
                var url = 'Opportunity.aspx?entityid=' + his.OpportunityId;
                window.location = url;
            }));
            
        }
    });
    return editor;
});
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!