locked
SQK.JQuery.retrieveMultipleRecords firing multiple times RRS feed

  • Question

  • Given the function below which is called once on a contact entity field event handler, the retrieveMultipleRecords is firing about 6-8 times. The onchange event handler for a Contact field is firing once (confirmed).

    function tssLoadSecurityRoleId(rolename) {
        alert("load Security Role");
        var select = "$select=RoleId" + "&$filter=Name eq '" + rolename + "' ";
        alert("select: " + select);
    
        SDK.JQuery.retrieveMultipleRecords(
            tssFormatProperCase("role"),
            select,
            function (results) {
                alert("role: retrieve multiple records:results.length:" + results.length);
                if (results.length > 0) {
                    alert("results.length > 0");
                    var obj = results[0];
                    alert("roleid:" + obj["RoleId"]);
                    tss_v_UIMerge_Security_Role_Guid = obj["RoleId"];
                    alert(tss_v_UIMerge_Security_Role_Guid);
                    tssCheckUserRole();
                }
                else {
                    alert("Role not found in system:" + rolename);
                    return;
                }
            },
            tssErrorHandler,
            tssOnComplete
        );
    }

    note that the alert for "load Security Role" displays once. However, the alert for

    "role: retrieve multiple records:results.length:"

    displays 6-8 times. The only thing I can spot is that its the first call to the JQuery SDK REST library from the code. Note: there are other solutions from other vendors at the client site...and there is another JQuery library loaded as a web resource. Could it be that the AJAX call binds itself to all the jquery libraries loaded? this is only at a single client install...internally on multiple configurations, this has not been a problem.

    Note: I have found 5 JQuery libraries loaded...wow...I guess each vendor has loaded it separately...


    Tuesday, April 1, 2014 3:33 PM

Answers

  • never mind. the query is legitimately returning 318 rows (at 50 rows each) due to a weird business unit setup at the client. Apparently, the role table unique key is (businessunit,roleid) and there are 318 business units combinations with the role I am looking for.
    Wednesday, April 2, 2014 6:49 PM