Saleslogix Mobile, Safari, iOS and Your Sanity
Posted By: Alex.Cottner on July 15th, 2014 in General
No Gravatar

Today I troubleshooted a strange issue with Saleslogix mobile on iOS. Whenever the user would hit the back button in the mobile client, they would actually get returned to the previous website they were on rather than the previous form in the mobile. After a lot of head scratching, I discovered this was due to a single setting being enabled in Safari. If the “Show Favorites Bar” setting has been enabled in Safari, this unexpected behavior will happen.

Update: A discussion with a Saleslogix support rep revealed that this, as well as some other iOS problems, can be resolved by setting the default document to index-nocache.aspx.

Saleslogix 8.x – Exporting a grid’s data to CSV client side
Posted By: Alex.Cottner on May 2nd, 2014 in General
No Gravatar

Sometimes you just want to make a form as client side as possible. Below is an example of how to export an Editable Grid’s data to CSV. This can be done from a quickform. This is just an “On Client Click” action for a Standard Button control.

Client Side Image Resize and Base64 Conversion
Posted By: Alex.Cottner on February 4th, 2014 in General
No Gravatar

The following requires some HTML5 features, so be sure to consult a compatibility chart before throwing it into a customer’s environment.

I needed a way for a user to upload an image as a base64 string. This could be happening from a poor bandwidth connection, so the usual server-side resize/encode wasn’t going to be an option. After a little bit of research my proof of concept looked like this.

I didn’t see any other examples of this so I thought I would post it here.

// make the file upload utility on page load
var photoField = dojo.byId("photoDiv");
var fu = document.createElement('input');
fu.type = "file";
fu.accept = "image/jpg,image/jpeg"; = "fuContactPhoto";
fu.onchange = photoConvert;

function photoConvert() {
    var fu = document.getElementById("fuContactPhoto"); // grab the file browser
    var f = fu.files[0]; // grab the file
    var fr = new FileReader(); // create a new file reader
    fr.readAsDataURL(f); // base 64 it
    fr.onload = function() {
        var tempImage = new Image();
        tempImage.src = fr.result; // to get the base64 result
        setTimeout(function() { // adding a .2 second delay because of some strange timing problems on ios
        var height = tempImage.height;
        var width = tempImage.width;
        if (height > 100) { // max height for our purposes is 100 pixels
            width = width / (height / 100);
            height = 100;
        if (width > 150) { // max width for our purposes is 150 pixels
         height = height / (width / 150);
         width = 150;
        var c = document.createElement('canvas');
        c.width = width;
        c.height = height;
        var ctx = c.getContext("2d");
        ctx.drawImage(tempImage, 0, 0, width, height);
            var b64str = c.toDataURL("image/jpeg"); // grab a base64 copy of the resized image as a jpeg
        document.getElementById('photoBase64Value').value = b64str.replace("data:image/jpeg;base64,", ""); // set hidden field with our value to save
        }, 200);

Saleslogix Mobile Client – Multiselect Picklist Values
Posted By: Alex.Cottner on February 4th, 2014 in General
No Gravatar

Today I needed to make a picklist field multiselect in the Saleslogix mobile client. Unfortunately this appears to be broken in Mobile 3.0.3. To work around this I had to override two functions in the picklist field’s definition on the edit form. Hopefully this will save somebody else a little time.

The functions in question are formatValue and textRenderer.

    name: 'Type',
    property: 'Type',
    type: 'picklist',
    label: 'type',
    picklist: 'Contact Type',
    singleSelect: false,
    maxTextLength: 64,
    formatValue: function(values) {
        var a = [];
        for (key in values)
        return a.join(",");
    textRenderer: function(values) {
        if ( == "String")
            return values;
        var a = [];
        for (key in values)
        return a.join(",");
    validator: validator.exceedsMaxTextLength

Custom Buttons in an Editable Grid Quickform – Saleslogix 8.0/8.1
Posted By: Alex.Cottner on January 22nd, 2014 in General
No Gravatar

Today I wanted to add several custom buttons (schedule activity and complete unscheduled activity buttons) in an editable grid. At first I thought about doing the usual convert to custom smart part, however that would have made simpler customizations down the road a little more difficult. So I decided to just take advantage of the custom format function and try to inject the custom buttons that I wanted.

Custom buttons on our grid

First, I added just a regular editable field and bound it to an arbitrary field in the data set. See screenshot below.
Custom format property