Adding keyboard shortcuts in SalesLogix
Posted By: nicocrm on October 12th, 2010 in Javascript, Saleslogix
No Gravatar

For data entry screens keyboard shortcuts are an incredibly useful way to make the form faster and more user friendly.  Users who bang at the screen all day will learn the shortcuts surprisingly fast and thank you for saving their wrists.  Of course this should be used together with other techniques such as proper keyboard focus management and ensuring there is no auto-postback causing an undue delay.

With the jQuery library included with SalesLogix it is pretty easy to set up, here is an example of how I am using it to trigger certain buttons when Ctrl+N, Ctrl+R etc are pressed:

$(document).keydown(function (e) {
    if (e.which == 'N'.charCodeAt(0) && e.ctrlKey) {
        if ($("#<%# btnNextFax.ClientID %>").is(":visible"))
        // this check is to prevent them from slamming repeatedly on Ctrl+N
            $("#<%# btnNextFax.ClientID %>").click();
        return false;
    if (e.which == 'R'.charCodeAt(0) && e.ctrlKey) {
        if ($("#<%# btnRefresh.ClientID %>").is(":visible"))
            $("#<%# btnRefresh.ClientID %>").click();
        return false;
    if (e.which == 'D'.charCodeAt(0) && e.ctrlKey && $("#<%# btnDeleteSelected.ClientID %>").is(":visible")) {
        // short delay so that the handler is over by the time the prompt shows up
        setTimeout(function () { $("#<%# btnDeleteSelected.ClientID %>").click(); }, 100);
        return false;
    if (e.which == 'A'.charCodeAt(0) && e.ctrlKey && $("#<%# btnSelectAll.ClientID %>").is(":visible")) {
        $("#<%# btnSelectAll.ClientID %>").click();
        return false;

It’s important to remember to only register the handler once… and if you register in a dialog smartpart you need to make sure to undo it (otherwise it will try to trigger the button again even once the dialog is hidden)!  This can be done calling $(document).unbind(‘keydown’, myfunction)  (in that case you have to make sure you keep a reference to your handler). 

Change lookup seedvalue at runtime
Posted By: nicocrm on October 5th, 2010 in Saleslogix
No Gravatar

You can change the “SeedValue” of a lookup (used for additional query filter) by simply assigning it from the code behind, during a postback or during the initial page load.

If you want to assign it from client script, you need a few extra steps. First of all, the current seed value can be set simply by assigning it:

luProj._currentSeedValue = newAccId;
luProj._seedValue = newAccId;

I have no idea why there are 2 values. It looks like just setting “currentSeedValue” works right now but I just set them both to be safe.

This works fine if there is no initial seed value on the lookup. However, if the value was set from the code behind, it will actually get hard-coded in the lookup object. The most effective way I have found to get rid of it is overriding the “show” method to remove the optional parameter it accepts:

luProj._oldshow =; = function() { return this._oldshow(); }

Don’t forget that if there is a postback, the value you set from the client side will be lost. So either register your script to get called again, or add logic on the server to add the seedvalue on the postback (as usual, the motivation for not having the server do it in the first place is to avoid the postback delay, loss of keyboard focus, etc)