Customizing the Activity Dialog in Infor CRM to Default the Activity Location to the Selected Contact’s Address

Customizing the Activity Dialog in Infor CRM Web is not like customizing other forms. This form is not a QuickForm/SmartPart or ASP.NET form. Instead, it is made entirely of Javascript. However, once you’ve learned the basics of how to work with it, you actually have every bit as much flexibility, or more, than working with a traditional QuickForm. In this article, we will look at how to add a simple customization to default an activity’s location to the selected contact’s address.

Before we look at the code, I will be using my Custom Loader Module that I have blogged about previously. Visit the link below, download the bundle and install it. The module that bundle installs allows us to simply drop a Javascript file into a folder without the need to wire it up in the master page.

Get the Custom Loader Module
Note: There’s a link to the bundle at the bottom of the page when you follow this link. Just install the bundle and you’re set.

Once the Custom Script Loader Module is installed, if you look in the SlxClient portal in AA, under SupportFiles, you’ll see a new folder named Custom. Inside that folder there is a folder named Modules. We’re going to be placing our custom code there. For customizing the ActivityDialog, there’s a few different ways that can be done. You’ll typically see that done via an inheritance-like way where you override a method. We’re going to be using one of my favorite methods, using Dojo’s aspect module. Aspect lets you piggyback before, after, or around another method in another class. We’re going to create a method that runs after the _contactChanged function in the ActivityDialog runs (which fires after a contact is set for the activity). We’re basically attaching more code that runs after the code in that method runs, like an extension of that function.

Under the SupportFiles\Custom\Modules folder, create a new folder named ActivityLocation. Then, inside that folder, create a new text file named “main.js” and paste in the code below:

define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/aspect', 
    'Sage/Data/SDataServiceRegistry',
    'Sage/MainView/ActivityMgr/ActivityEditor'
], 
function (declare, lang, aspect, SDataServiceRegistry, ActivityEditor) {
    
    function initializeActivityEditor() {
    
        aspect.after(ActivityEditor.prototype, '_contactChanged', function(contact) {
            // Uncomment these lines if you want to default the location for
            // Meetings only. Otherwise will default for all activity types
            //if (this.activityType != 'atAppointment')
            //    return;
            
            // if contact cleared, clear location
            if (!contact || !contact['$key']) {
                Sage.Utility.setValue(this._activityData, 'Location', '');
                this.tb_Location.set('value', '');
                return;
            }
            
            // get address data for contact
            var req = new Sage.SData.Client.SDataSingleResourceRequest(SDataServiceRegistry.getSDataService('dynamic'))
                .setResourceKind('contacts')
                .setResourceSelector('"' + contact['$key'] + '"')
                .setQueryArg('include', 'Address')
                .setQueryArg('select', ['Address/Address1','Address/Address2','Address/City','Address/State','Address/PostalCode','Address/Country'])
                
            req.read({
                success: function (data) {
                    var address = lang.getObject('Address', null, data);
                    if (!address)
                        return;
                    
                    var address1 = address.Address1,
                        address2 = address.Address2,
                        city = address.City,
                        state = address.State,
                        zip = address.PostalCode,
                        country = address.Country,
                        location = '';
                    
                    if (address1 && address1.trim() != '')
                        location = address1;
                    if (address2 && address2.trim() != '')
                        location += ', ' + address2;
                    if (city && city.trim() != '')
                        location += ' ' + city;
                    if (state && state.trim() != '')
                        location += ', ' + state;
                    if (zip && zip.trim() != '')
                        location += ' ' + zip;
                    if (country && country.trim() != '')
                        location += ' ' + country;
                    
                    // set location
                    if (location.trim() != '')
                    {
                        Sage.Utility.setValue(this._activityData, 'Location', location);
                        this.tb_Location.set('value', location);
                    }
                },
                scope: this
            });
        }, true);
    }
    
    // run customizations 
    initializeActivityEditor();
});

That’s it (well, also a build & deploy). Now, when you open the activity dialog, any time a contact is selected (including if it is populated from the current record, etc), it will set the activity location to the contact’s address.

Contact Customer FX for your CRM project
We let our expertise speak for itself - let us know how our all-star team can help on your CRM project
About the Author
Ryan Farley
Ryan Farleyhttps://customerfx.com/article/author/ryanfarley/
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. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Infor CRM SLX 10.0: Delegate Ownership Changes for “Everyone” Records

Learn how the new EveryoneOwnerAssignment secured action in Infor CRM SLX 10.0 allows designated users to change ownership of Everyone-owned records without requiring Administrator access.

Related Articles

Infor CRM Sync for Exchange: Action Required by August 31, 2026

Using Infor CRM Sync for Exchange with Microsoft 365? Your Exchange administrator must update tenant settings by August 31, 2026 to prevent sync disruption.

[Webinar] What’s Coming Next for Infor CRM SLX and Why v10 Matters

See what’s coming next for Infor CRM SLX, including new marketing workflows, automation improvements, and reasons to consider upgrading to v10.

Disable Caching in Infor CRM SLX Web Client

In the rare case caching is causing issues in the Infor CRM SLX web client, it is possible to disable specific types of caching by making edits using Application Architect, and then deploying.

Exploring AI Options for Infor CRM v10

I've started taking a closer look at the AI capabilities built into Infor CRM v10. Over the next several posts, I'll share what I learn. From the built-in features and supported AI providers to implementation considerations, costs, and practical use cases.

Related Videos