Spotfire web player 5.0
Posted By: Doddy.Amijaya on February 22nd, 2014 in Spotfire
No Gravatar

I have done spotfire installation and integrate it with SalesLogix a handful of times now. I ran into some snags here and there. I’d like to share the issue that I ran into recently when installing and integrating Spotfire with SalesLogix.

I have installed the Spotfire server, the fat client, webplayer and the deployment. I also installed the latest hotfix and patch for the server and the application.
For some reason I kept getting the following error in the AJAX request:


{"waid":"c718177454d1766054b0f-c401","nodeId":"c718177454d1766054b0f-c401","callback":"Init","args":"{\"scrollbarWidth\":16,\"windowSize\":{\"width\":1280,\"height\":919},\"timezoneOffset\":480}"}


System.InvalidOperationException: Spotfire.Dxp.Web.Response cannot be serialized because it does not have a parameterless constructor.
at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError)
at System.Xml.Serialization.ModelScope.GetTypeModel(Type type, Boolean directReference)
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)
at System.Web.Services.Protocols.XmlReturn.GetInitializers(LogicalMethodInfo[] methodInfos)
at System.Web.Services.Protocols.HttpServerType..ctor(Type type)
at System.Web.Services.Protocols.HttpServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

I thought maybe because I haven’t installed the ASP.NET 2.0 AJAX extension, so I installed that but still no luck.
Next step I undo the custom Java Authentication and Authorization Service (JAAS) and using spotfire db authenticatio instead….
Still not working.


THE FIX :

go to C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319
and run this command : aspnet_regiis -i

………

and it fixes it!!


Updating Time Units in Ticket Activities entity
Posted By: Doddy.Amijaya on February 14th, 2014 in Saleslogix
No Gravatar

Recently I’ve got a request to customize add/edit ticket activities form so that when users click the save button it will auto populate the Completed Date field with the current date and time. The other requirement is the units needs to be rounded up

so that’s easy. I made the changes as requested and it did save the value of the Completed Date. However Unfortunately no matter how long is the duration between assigned date and completed date the time units is always 0. Weird huh?

No matter how I set the Units property when I called .save() it will set it back to 0. I tried using snippet code and on before insert/on after insert Business rules but still no luck. it will always set it to 0.

so this is the work around that I came up with

ticketActivity.CompletedDate = DateTime.Now.AddSeconds(30);
ticketActivity.Save();
object[] objarray = new object[] { this.BindingSource.Current };
Sage.Platform.EntityFactory.Execute("TicketActivity.DoTicketActivityCalculations", objarray);

Calling the DoTicketActivityCalculations method will set the units and it works perfectly.
I don’t know if everybody but me knew this but thought I’d share.


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";
fu.id = "fuContactPhoto";
fu.onchange = photoConvert;
photoField.appendChild(fu);

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)
            a.push(values[key].data.text);
        return a.join(",");
    },
    textRenderer: function(values) {
        if (values.constructor.name == "String")
            return values;
        var a = [];
        for (key in values)
            a.push(values[key].data.text);
        return a.join(",");
    },
    validator: validator.exceedsMaxTextLength
}