Adding the standard SalesLogix Save prompt to an Insert Screen in the SalesLogix Web Client

If you have used the web client for SalesLogix one of the things that you will have noticed is that when you are on an existing record, when you make changes to the record the SalesLogix BindingService automatically detects the record has changed and displays a “* unsaved data” prompt at the top of the page.  if a user tries to navigate away from the record before they click the Save button they will get a client side prompt asking the user they are sure they want to navigate off the page.

 

Unfortunately the one area of the web client that is lacking this functionality is on the Insert Screens.  This is because at the point of an insert, the Entity does not yet really exist.  However, a user could spend a lot of time on an insert screen, filling out all of the details of about the new record.  If they accidentally navigate away from the page, all of the data they just entered goes bye-bye.

If you are tired of users complaining that they forgot to save a record before leaving the insert screen in SalesLogix there is a solution involving adding some client side scripting to your page.  On quickforms, the easiest way to do this is using a RegisterClientScriptBlock server side code block on the form load event.  Here is a sample of code that will achieve this:

string dirtyscript = “var dirty = false; var flagmgr= Sage.Services.getService(“ClientBindingManagerService”); if (flagmgr){ flagmgr.markDirty(); dirty=true;}”;
string confirm =”function closeIt(){ ” +                    
                “if (dirty) ” +
                ”    return “You have unsaved data.  If you continue you will lose any chnages you have made.”; ” +
                “else ” +
                ”    return null;}” +
                ” window.onbeforeunload = closeIt;”;
ScriptManager.RegisterClientScriptBlock(Page, GetType(),”MarkDirty”, dirtyscript, true);
ScriptManager.RegisterClientScriptBlock(Page, GetType(),”ConfirmLeaving”, confirm, true);

ABOUT THE AUTHOR

Kris Halsrud

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

1 Comment

  1. On further analysis this solution doesn’t seem to work too well with popup dialogs; for example, the warning message will appear when the user attempts to change a lookup value (which is a dialog). A different solution that seems to be working well so far is just to put the following two lines of code in the OnPreRender event…

    if (IsPostBack)
    this.ClientBindingMgr.CurrentEntityIsDirty = true;

    The only drawback, I guess, is that the flag gets set on every postback, regardless of whether something changed but…

    Reply

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) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!