Developing on the New Sage SalesLogix Mobile – Completing an Unscheduled Activity
Posted By: Alex.Cottner on September 28th, 2011 in General, Javascript, Programming, Saleslogix
No Gravatar

One of the big pushes in technology in this day and age are mobile and tablet applications. The new mobile client Sage SalesLogix offers is built for just that. It is built off of HTML5 and works hand-in-hand with their SData feeds.

In this post I am going to demonstrate a functionality request that we receive from a lot of our users.

Completing an Unscheduled Activity

One of the most frustrating things for end-users is the amount of clicks they have to do to complete a certain task regardless of what software or web site they are using. In this example if a user wanted to complete an unscheduled meeting with a contact in the new mobile client they would first have to:

1. Go to the contact record.
2. Hit the Scheduled Activity button under Quick Actions.
3. Select Meeting from the activity type screen.
4. Enter in the information for the Meeting.
5. Hit the save button.
6. Be redirected to the contact and then click the Activities button under Related Items.
7. Be redirected to the Activities screen showing the list of Activities waiting to be complete.
8. Click on the created activity.
9. Be redirected to the Activity Detail screen and hit the Complete Activity button under Quick Actions.
10. Fill in all the information for completing the activity and hit Save.
That is 10 steps one would have to take to do something that a lot of users would want to do as quickly as possible.

In this example I am going to show how we can cut down the number of steps a user would have to take to complete this activity.

If we take a look at the Detail.js file in /argos-*yourappname*/src/views/contact/, you’ll see that there is an existing function here called navigateToHistoryInsert.

This is here because the Call Phone Number and Send Email quick actions use this function to insert history records for those activity types directly into the system. What we are going to do is just create our own function that builds the information for our entry object that will insert the data via this function.

recordMeetingToHistory: function(complete) {
            var entry = {
                '$name': 'History',
                'Type': 'atAppointment',
                'ContactName': this.entry['NameLF'],
                'ContactId': this.entry['$key'],
                'AccountName': this.entry['AccountName'],
                'AccountId': this.entry['Account']['$key'],
                'Description': String.format("Meeting with {0}", this.entry['NameLF']),
                'UserId': App.context && App.context.user['$key'],
                'UserName': App.context && App.context.user['UserName'],
                'Duration': 15,
                'CompletedDate': (new Date())
            };

            this.navigateToHistoryInsert('atMeeting', entry, complete);
        },

Let me explain a little bit about what is going here. We first have to create an entry into the SData feed that will be passed from the navigateToHistoryInsert function. In this entry we are pre-populating some of the values that are in the history feed. We reference what feed we want to use with $name: ‘history’. We want this to come in as a type of 262145 which is a meeting so we set the ‘Type’ to ‘atAppointment’. We also set the contact name, contactid, account, accountid, etc based on the existing information we have in the current feed which is contacts. One important thing to point out here is the contactid and accountid values. We have to reference the id’s that SalesLogix has stored with these records by the $key property so since we are on the contact feed by default we can just reference the contactid by this.entry['$key']. To get the accountid that this contact is attached to we just specify the account feed from contact with this.entry['Account']['$key'].

We then pass all of this information in our entry object as well as the activity type and complete to the navigateToHistoryInsert function and then it takes over from there.

One last thing we will have to do is create our icon and link under the Quick Actions band.

Under the createLayout function insert your property into the array being built.

{
   name: 'Meeting',
   label: 'Complete Unscheduled Meeting',
   icon: 'content/images/icons/Schedule_Meeting_24x24.png',
   action: 'recordMeetingToHistory'
},

An important point to talk about here is the action property. We want to make sure we reference our recordMeetingToHistory function earlier in the script here otherwise the button will not do anything.

This is not a perfect solution by any means but there are ways to improve it. One drawback to doing it this way is you lose the complete form with the other options you can set like duration, completed date, etc that we are just pre-populating on the fly when we call the history insert form. You can always modify the insert form being called to show the fields you would want your users to fill out if they needed to quickly complete an activity that’s not already created.

Here is a quick video of the customization.

Demo of Quickly Completing Meeting


Leave a Reply