Fixing Inconsistent “Unsaved Data” Message Appearance in the Infor CRM Web Client

The Infor CRM web client in at least versions 8.3.09 and 8.3.10 there is inconsistency in when, or if, the “Unsaved Data” dirty flag appears at the top of the web client to let users know that there are unsaved changes on the page.

Sometimes this flag does not show until a post back occurs. If the user tries to leave the page they will still get the prompt asking “are you sure you want to leave…” so the portal is detecting there are changes, it just is not properly showing the message.

This message is contained in a div element that is positioned up near the page title and then shown or hidden based on if there is unsaved data using the “ClientBindingManagerService”. This is the client side service that controls the dirty data process.

I dug into why this message was not always showing and discovered that there are 2 parts to the message

  1. Position the div containing the message on the page next to the title.
  2. Show or hide the message based on if there are unsaved changes

It turns out that the issue is while the message showing or hiding was correctly being handled by the ClientBindingManagerService when there was unsaved data, the part that was not always working was the positioning of the element on the page next to the title. So the message was there but it was located in the lower left of the page, beneath the Infor Copyright message, which is not a helpful place to be since it is hidden.

I was able to fix this issue by extending the ClientBindingManagerService and utilizing Dojo’s aspect class was able to alter the base “markDirty” function to ensure that the label was properly positioned and that it showed correctly. The following code shows how this was done.

define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/aspect',
    'Sage/Services/ClientBindingManagerService'
],
    function (declare, lang, aspect, bindingMgr) {
        aspect.after(bindingMgr.prototype, 'markDirty', function (e) {            
            var mgr = Sage.Services.getService("ClientBindingManagerService");
            if (mgr) {
                if (mgr._WatchChanges) {
                    mgr._CurrentEntityIsDirty = true;
                    if (mgr._IgnoreDirtyFlag === false || 1===1) {
                        var dirtyctrl = dojo.byId(mgr._MsgDisplayID);                        
                        var title = dojo.query('#PageTitle');                        
                        if (title && title.length > 0 && dirtyctrl ) {
                            dojo.place(dirtyctrl, title[0], 'after');
                            dojo.style(dirtyctrl, 'top', dojo.marginBox(title[0]).t + 'px');
                            dojo.style(dirtyctrl, 'left', dojo.marginBox(title[0]).w + 'px');
                            dojo.style(dirtyctrl, 'display', 'inline');
                        }                                              
                    }
                }
            }            
        });
    });

To implement this I would recommend implementing this as a new module using Ryan’s totally tubular Custom Loader module.

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!