Fix for Setting the Title on Detail Views When Navigating from SpeedSearch Results in the Infor CRM Mobile Client

I had never noticed before until a client brought it up, but in the Infor CRM Mobile client, if you navigate to an account, then do a SpeedSearch search and select a different account, the top title of the detail view will show the previously selected account, not the one you just selected from the SpeedSearch results. This isn’t just the case with accounts, but any entity you’ve previously visited and then select that same entity type from the SpeedSearch results. The detail view will still show the previous record’s title (account name, etc).

The reason this is the case is because the SpeedSearch list view in mobile doesn’t pass a descriptor, or title, for the detail view when it opens it. The SpeedSearch view works a little differently than other list views. It actually set’s the result’s descriptor to be the entity type for that specific result. So for an account, it will set that result row’s descriptor to be “Account” instead of something like “Abbott Worldwide”. However, one side-effect of records returned by SpeedSearch is that the descriptor is already prefixed with the entity type, so “Abbott Worldwide” is actually returned with a descriptor of “Account: Abbott Worldwide”. To fix this, we are going to change the SpeedSearchList to use the result’s descriptor, then we’ll split the value so we end up with the result’s type *and* actual descriptor value. Then we can pass that descriptor to the view and all will display correctly.

The following ApplicationModule will fix this issue:

define('Mobile/Custom/ApplicationModule', [
    'dojo/_base/declare',
    'dojo/_base/lang'
], function (
    declare,
    lang
) {
    return declare('Mobile.Custom.ApplicationModule', argos.ApplicationModule, {
    
        loadCustomizations: function () {

            // extend the SpeedSearchList to change it to use the
            // entity's actual descriptor value
            lang.extend(crm.Views.SpeedSearchList, {
                // override the getItemDescriptor
                getItemDescriptor: function getItemDescriptor(entry) {
                    return entry.$descriptor;
                },
            
                // override it's navigateToDetailView so we can split the 
                // descriptor to use both it's type (to get the correct detail view) 
                // and it's descriptor (to pass to the detail view)
                navigateToDetailView: function navigateToDetailView(key, type) {
                    var descriptor;
                    
                    var parts = type.split(':');
                    type = parts[0];
                    
                    if (parts.length < 2) {
                        descriptor = type;
                    } else if (parts.length == 2) {
                        descriptor = parts[1].trim();
                    } else {
                        // in case the actual name/descriptor also contained a 
                        // colon we will put it all back together
                        var newParts = parts.slice(1, parts.length);
                        descriptor = newParts.join(':').trim();
                    }
                    
                    // now navigate to detail view and pass descriptor 
                    var view = App.getView(type.toLowerCase()  + '_detail');
                    if (view) {
                        view.show({
                            key: key,
                            descriptor: descriptor
                        });
                    }
                }
            });
        
        }
        
    });
});

Now everything will appear correctly when navigating from the SpeedSearchList to the detail views.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

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!