Error in Cases on Dev

I have a problem on my Development 7.12 box that does not exist on my Production 7.12 box and is most likely self induced. First, the dev box was at 7.11 and I upgraded it thinking this problem could be resolved but did not. The production box was installed using version 7.12.

I do have customization’s on the Cases. The custom/modules/js/detailfiew.js:

$(document).ready(function () {
    $("a#tab1").hide();
    
    if ($("#meetingid_c").html() != "") {
        $("div[field='create_schedule']").parent('div').addClass("hidden");
    } else {
        $("div[field='create_schedule']").parent('div').removeClass("hidden");
        $("div[field='meetingid_c']").parent('div').addClass("hidden");
    }

    $("#serviceid_c_span").find("option").eq(0).remove();
    $("div[field='serviceid_c'] div.inlineEditIcon span.suitepicon-action-edit").hide();
    
    var userNum = $("#serviceid_c_span option:selected").val();
    if (userNum !== undefined && !isNaN(userNum)) {
        getUserServices(userNum);
    }
    
});

function getUserServices(number) {
        $.ajax({
            method: "GET",
            url: "/index.php?entryPoint=caseGetServices",
            data: "get=BmCpeMacPopState&service=" + number,
            type: JSON,
            success: showServicesStatus,
        });
}

function showServicesStatus(obj) {
    $("#cpe_mac_status_c").html(obj.html);
}

I noticed a problem on the dev box while trying to upload a document to a case. The files appeared to not upload and never showed any files. The Web Developer console shows the following error when clicking on a case (detail view). I do not get this error on my production box.

10:50:21.767 error adding script
10:50:21.767 SyntaxError: expected expression, got '<'
    globalEval http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1.js?v=8KFk1GvnAT7aXsZsiVyqpw:418
    globalEval http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1.js?v=8KFk1GvnAT7aXsZsiVyqpw:418
    evalScript http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1.js?v=8KFk1GvnAT7aXsZsiVyqpw:424
    callback http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1.js?v=8KFk1GvnAT7aXsZsiVyqpw:619
    handleTransactionResponse http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1_yui.js?v=8KFk1GvnAT7aXsZsiVyqpw:31
    handleReadyState/this._poll[c.tId]< http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1_yui.js?v=8KFk1GvnAT7aXsZsiVyqpw:31
    setInterval handler*handleReadyState http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1_yui.js?v=8KFk1GvnAT7aXsZsiVyqpw:31
    asyncRequest http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1_yui.js?v=8KFk1GvnAT7aXsZsiVyqpw:31
    go http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1.js?v=8KFk1GvnAT7aXsZsiVyqpw:640
    o http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1_yui.js?v=8KFk1GvnAT7aXsZsiVyqpw:290
    j http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1_yui.js?v=8KFk1GvnAT7aXsZsiVyqpw:290
    f http://suitecrm2-dev.mydomain.com/cache/include/javascript/sugar_grp1_yui.js?v=8KFk1GvnAT7aXsZsiVyqpw:290
sugar_grp1.js:425:119

10:50:21.772 Array(4) [ "<script id=\"updateFileRowTemplate\"  type=\"text/template\">\n    <span class=\"caseDocumentWrapper\">\n        <select class=\"caseDocumentTypeSelect\">\n            <option value=\"internal\">Internal CRM document</option>\n            <option value=\"external\">External file</option>\n        </select>\n        <input type=\"file\" id=\"case_update_file[]\" name=\"case_update_file[]\">\n        <span class=\"internalCaseDocumentWrapper\">\n            <input type=\"text\" name=\"case_document_name\" class=\"sqsEnabled\" tabindex=\"0\" id=\"case_document_name\" size=\"\" value=\"\" title='' autocomplete=\"off\">\n            <input type=\"hidden\" name=\"case_document_id\" id=\"case_document_id\" value=\"\">\n\n            <span class=\"id-ff multiple\">\n                <button type=\"button\" name=\"btn_case_document_name\" id=\"btn_case_document_name\" tabindex=\"0\" title=\"Select document\" class=\"button firstChild\" value=\"Select document\"\n                        \n                        onclick='open_popup(\n                                \"Documents\",\n                                600,\n                                400,\n                                \"\",\n                                true,\n                                false,\n                                {\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":\"case_document_id\",\"name\":\"case_document_name\"}},\n                                \"single\",\n                                true\n                                );' >\n                        \n                <span class=\"suitepicon suitepicon-action-select\"></span></button>\n                <button type=\"button\" name=\"btn_clr_case_document_name\"\n                        id=\"btn_clr_case_document_name\" tabindex=\"0\" title=\"Clear document\"  class=\"button lastChild\"\n                        onclick=\"SUGAR.clearRelateField(this.form, 'case_document_name', 'case_document_id');\"  value=\"Clear document\" ><span class=\"suitepicon suitepicon-action-clear\"></span></button>\n            </span>\n        </span>\n\n<button class=\"removeFileButton\" type=\"button\">Remove file</button><br>\n    </span>\n\n</script>", " id=\"updateFileRowTemplate\"  type=\"text/template\"", "\n    <span class=\"caseDocumentWrapper\">\n        <select class=\"caseDocumentTypeSelect\">\n            <option value=\"internal\">Internal CRM document</option>\n            <option value=\"external\">External file</option>\n        </select>\n        <input type=\"file\" id=\"case_update_file[]\" name=\"case_update_file[]\">\n        <span class=\"internalCaseDocumentWrapper\">\n            <input type=\"text\" name=\"case_document_name\" class=\"sqsEnabled\" tabindex=\"0\" id=\"case_document_name\" size=\"\" value=\"\" title='' autocomplete=\"off\">\n            <input type=\"hidden\" name=\"case_document_id\" id=\"case_document_id\" value=\"\">\n\n            <span class=\"id-ff multiple\">\n                <button type=\"button\" name=\"btn_case_document_name\" id=\"btn_case_document_name\" tabindex=\"0\" title=\"Select document\" class=\"button firstChild\" value=\"Select document\"\n                        \n                        onclick='open_popup(\n                                \"Documents\",\n                                600,\n                                400,\n                                \"\",\n                                true,\n                                false,\n                                {\"call_back_function\":\"set_return\",\"form_name\":\"EditView\",\"field_to_name_array\":{\"id\":\"case_document_id\",\"name\":\"case_document_name\"}},\n                                \"single\",\n                                true\n                                );' >\n                        \n                <span class=\"suitepicon suitepicon-action-select\"></span></button>\n                <button type=\"button\" name=\"btn_clr_case_document_name\"\n                        id=\"btn_clr_case_document_name\" tabindex=\"0\" title=\"Clear document\"  class=\"button lastChild\"\n                        onclick=\"SUGAR.clearRelateField(this.form, 'case_document_name', 'case_document_id');\"  value=\"Clear document\" ><span class=\"suitepicon suitepicon-action-clear\"></span></button>\n            </span>\n        </span>\n\n<button class=\"removeFileButton\" type=\"button\">Remove file</button><br>\n    </span>\n\n", "\n" ]
sugar_grp1.js:425:134

When trying to upload an external document in the Edit View and clicking Save or Save and Continue, I do not see any error messages. However, the POST statement shows a 301 Moved Permanently Error (production does not). Looking in the database at the Notes table I can see the document has been add. There is a file matching the id in the uploads folder (not sure if the file is stored in a table).

Reloading the page after the upload attempt I don’t see any files listed anywhere. On my production box under the CASE UPDATES section I can see the files uploaded. My dev box does not show a CASE UPDATES section.

My first thought is that I make a mistake on a JavaScript file somewhere but have not found any yet.
I downloaded the production SuiteCRM folder and did some diffing between production and dev code folders but am unable to find any differences that stick out.

I am not sure where to look next. Any help would be greatly appreciated.

Tony

Have you tried all the Javascript repairs in Admin / Repairs ?

Yes, everyone I could find then did a repair.

If you’re using a language pack, try turning it off and see if the error persists.

Problems in language packs are usually due to the delimeters. Typically an unescaped apostrophe.

I noticed that this problem is either back or I never got it resolved. None the less I still have this pesky “error adding script” when I load up a case only in the DetailView.

This is what shows up in the browser console:

error adding script
sugar_grp1.js?v=icvJ4meTIhpaVzxt-Oz_WA:425 SyntaxError: Unexpected token '<'
    at eval (<anonymous>)
    at sugar_grp1.js?v=icvJ4meTIhpaVzxt-Oz_WA:418:156
    at Object.globalEval (sugar_grp1.js?v=icvJ4meTIhpaVzxt-Oz_WA:418:176)
    at Object.evalScript (sugar_grp1.js?v=icvJ4meTIhpaVzxt-Oz_WA:424:17)
    at Object.callback [as success] (sugar_grp1.js?v=icvJ4meTIhpaVzxt-Oz_WA:619:98)
    at Object.handleTransactionResponse (sugar_grp1_yui.js?v=icvJ4meTIhpaVzxt-Oz_WA:31:4422)
    at sugar_grp1_yui.js?v=icvJ4meTIhpaVzxt-Oz_WA:31:3935
sugar_grp1.js?v=icvJ4meTIhpaVzxt-Oz_WA:425 (4) ['\x3Cscript id="updateFileRowTemplate"  type="text/tem…">Remove file</button><br>\n    </span>\n\n\x3C/script>', ' id="updateFileRowTemplate"  type="text/template"', '\n    <span class="caseDocumentWrapper">\n        <s…e="button">Remove file</button><br>\n    </span>\n\n', '\n', index: 16691, input: "<div class='moduleTitle'>\n<h2 class='module-title-…elGroup);\n        }\n    }, 500);\n    \n\x3C/script>\n\n", groups: undefined]

I already made sure all files are owned by www-data . I am looking for some ideas on where else I can look for something out of place.

Thanks

Tony

Did some more digging into this. My custom/Cases/metadata/detailviewdefs.php has one entry that causes this. It is:

 9 =>
    array(
    0 =>
    array(
        'name' => 'case_update_form',
        'studio' => 'visible',
        'label' => 'LBL_CASE_UPDATE_FORM',
    ),
 ),

If I understand right this method is defined in /modules/Cases/vardefs which has this in it:

'case_update_form' => array(
    'required' => false,
    'name' => 'case_update_form',
    'vname' => 'LBL_CASE_UPDATE_FORM',
    'type' => 'function',
    'source' => 'non-db',
    'massupdate' => 0,
    'studio' => 'visible',
    'importable' => 'false',
    'duplicate_merge' => 'disabled',
    'duplicate_merge_dom_value' => 0,
    'audited' => false,
    'reportable' => false,
    'function' => array(
        'name' => 'display_update_form',
        'returns' => 'html',
        'include' => 'modules/AOP_Case_Updates/Case_Updates.php',
    ),
),

So looking at modules/AOP_Case_Updates/Case_Updates.php’ this display_update_form is:

/**
 * @return mixed|string|void
 */
function display_update_form()
{
    global $mod_strings, $app_strings;
    $sugar_smarty = new Sugar_Smarty();
    $sugar_smarty->assign('MOD', $mod_strings);
    $sugar_smarty->assign('APP', $app_strings);

    return $sugar_smarty->fetch('modules/AOP_Case_Updates/tpl/caseUpdateForm.tpl');
}

Which fetches modules/AOP_Case_Updates/tpl/caseUpdateForm.tpl which looks like this:

{*
/**
 *
 * SugarCRM Community Edition is a customer relationship management program developed by
 * ### REMOVED THE REST OF THE COMMENT ###".
 */
*}
<button id="addFileButton" class="button primary" type="button">{$MOD.LBL_ADD_CASE_FILE}</button>
{literal}
<script>
    $(document).ready(function(){
        var docCount = 0;
        $(document).on('change','.caseDocumentTypeSelect',function(){
            var wrapper = $(this).closest('.caseDocumentWrapper');
            if($(this).val() == 'internal'){
                wrapper.find('#case_update_file\\[\\]').hide();
                wrapper.find('.internalCaseDocumentWrapper').show();
            }else{
                wrapper.find('#case_update_file\\[\\]').show();
                wrapper.find('.internalCaseDocumentWrapper').hide();
            }

        });

        $('#addFileButton').click(function(e){
            var template = $('#updateFileRowTemplate').html();
            template = template.replace(/case_document_name/g, 'case_update_name_'+docCount);
            template = template.replace(/case_document_id/g, 'case_update_id_'+docCount);
            $(e.target).before(template);
            if(typeof sqs_objects == 'undefined'){
                sqs_objects = new Array;
            }
            sqs_objects['EditView_case_document_name_'+docCount]={
                "form":"EditView",
                "method":"query",
                'modules': 'Documents',
                "field_list":["name","id"],
                "populate_list":["case_document_name_"+docCount,"case_document_id_"+docCount],
                "required_list":["case_document_id_"+docCount],
                "conditions":[{"name":"name","op":"like_custom","end":"%","value":""}],
                "limit":"30",
                "no_match_text":"No Match"};
            SUGAR.util.doWhen(
                    "typeof(sqs_objects) != 'undefined' && typeof(sqs_objects['EditView_case_document_name_"+docCount+"']) != 'undefined'",
                    enableQS
            );

            $('.caseDocumentTypeSelect').change();
            docCount++;
        });
        $(document).on('click','.removeFileButton',function(e){
            $(e.target).closest('span').remove();
        });
    });
</script>
{/literal}
<script id="updateFileRowTemplate"  type="text/template">
    <span class="caseDocumentWrapper">
        <select class="caseDocumentTypeSelect">
            <option value="internal">{$MOD.LBL_SELECT_INTERNAL_CASE_DOCUMENT}</option>
            <option value="external">{$MOD.LBL_SELECT_EXTERNAL_CASE_DOCUMENT}</option>
        </select>
        <input type="file" id="case_update_file[]" name="case_update_file[]">
        <span class="internalCaseDocumentWrapper">
            <input type="text" name="case_document_name" class="sqsEnabled" tabindex="0" id="case_document_name" size="" value="" title='' autocomplete="off">
            <input type="hidden" name="case_document_id" id="case_document_id" value="">

            <span class="id-ff multiple">
                <button type="button" name="btn_case_document_name" id="btn_case_document_name" tabindex="0" title="{$MOD.LBL_SELECT_CASE_DOCUMENT}" class="button firstChild" value="{$MOD.LBL_SELECT_CASE_DOCUMENT}"
                        {literal}
                        onclick='open_popup(
                                "Documents",
                                600,
                                400,
                                "",
                                true,
                                false,
                                {"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"case_document_id","name":"case_document_name"}},
                                "single",
                                true
                                );' >
                        {/literal}
                <span class="suitepicon suitepicon-action-select"></span></button>
                <button type="button" name="btn_clr_case_document_name"
                        id="btn_clr_case_document_name" tabindex="0" title="{$MOD.LBL_CLEAR_CASE_DOCUMENT}"  class="button lastChild"
                        onclick="SUGAR.clearRelateField(this.form, 'case_document_name', 'case_document_id');"  value="{$MOD.LBL_CLEAR_CASE_DOCUMENT}" ><span class="suitepicon suitepicon-action-clear"></span></button>
            </span>
        </span>

<button class="removeFileButton" type="button">{$MOD.LBL_REMOVE_CASE_FILE}</button><br>
    </span>

</script>

The first thing I see is the line above the last /literal. The > should be below the /literal. But moving it there and Repair and Rebuild does not seem to fix the problem. I think he > is in the wrong place. It should be after the {/literal}.

Digging Deeper. I grabbed the source of sugar_grp1.js which is in cache/include/javascript/. I edited this file and found the text “error adding script”. I added some console.log() commands to trace what was going on.

What I have found is that the file modules/AOP_Case_Updates/tpl/caseUpdateForm.tpl is parsed using the regular expression:

var srcRegex=/.*src=['"]([a-zA-Z0-9_\-\&\/\.\?=:-]*)['"].*/gim; var result=objRegex.exec(text);

The results used are result[1] and result[2].

Next result[1] is checked for "src=", (result[1].indexOf("src=") > -1). If found then the script loaded into the browser. If not found then result[2] is checked for a comment tag <!-- --> using regular expression.

var srcRegex=/<!--([\s\S]*?)-->/; var srcResult=srcRegex.exec(result[2]);

If found then SUGAR.util.globalEval() is done on srcResult[1]. If not found then SUGAR.util.globalEval() is done on result[2].

In this case as you can see above there are no comment tags in

<script id="updateFileRowTemplate" type="text/template">

so the code then attempts to eval(result[2]) which is NOT JavaScript resulting in an error I pasted in the previous message.

I think this is a bug. If I add comment tags this page loads just fine. I don’t know though if this will affect any pages. I presume it is only for Case Updates. Does anyone else know?

I did unzip several versions of SuiteCRM version 7.11.15, 7.11.22 and 7.12.5 (this is the version I am running) and diffed the tpl file on all of them and they do not differ.

Looking for some direction on how to fix this.

Tony

So I think this is a bug.

I did a brand new install of V7.12.7. Immediately after the install finished:

  1. I logged Out.
  2. I logged In.
  3. Selected Cases
  4. Create Case
    and in the browsers Java Script Console I see this error:
error adding script
sugar_grp1.js?v=jEYagrbvlLgG0FXnIKZdBg:425 SyntaxError: Unexpected token '<'
    at eval (<anonymous>)
    at sugar_grp1.js?v=jEYagrbvlLgG0FXnIKZdBg:418:156
    at Object.globalEval (sugar_grp1.js?v=jEYagrbvlLgG0FXnIKZdBg:418:176)
    at Object.evalScript (sugar_grp1.js?v=jEYagrbvlLgG0FXnIKZdBg:424:17)
    at Object.callback [as success] (sugar_grp1.js?v=jEYagrbvlLgG0FXnIKZdBg:619:98)
    at Object.handleTransactionResponse (sugar_grp1_yui.js?v=jEYagrbvlLgG0FXnIKZdBg:31:4422)
    at sugar_grp1_yui.js?v=jEYagrbvlLgG0FXnIKZdBg:31:3935

How to fix?

I believe this is causes other JavaScript (specifically my custom script) to not execute.

Remember New install no other changes at all.

@pstevens what does your modules/AOP_Case_Updates/tpl/caseUpdateForm.tpl look like?

This is the file that is causing the error.

It’s reasonably short, I can paste it here:

{*
/**
 *
 * SugarCRM Community Edition is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
 *
 * SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
 * Copyright (C) 2011 - 2018 SalesAgility Ltd.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
 * reasonably feasible for technical reasons, the Appropriate Legal Notices must
 * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
 */
*}
<button id="addFileButton" class="button primary" type="button">{$MOD.LBL_ADD_CASE_FILE}</button>
{literal}
<script>
    $(document).ready(function(){
        var docCount = 0;
        $(document).on('change','.caseDocumentTypeSelect',function(){
            var wrapper = $(this).closest('.caseDocumentWrapper');
            if($(this).val() == 'internal'){
                wrapper.find('#case_update_file\\[\\]').hide();
                wrapper.find('.internalCaseDocumentWrapper').show();
            }else{
                wrapper.find('#case_update_file\\[\\]').show();
                wrapper.find('.internalCaseDocumentWrapper').hide();
            }

        });

        $('#addFileButton').click(function(e){
            var template = $('#updateFileRowTemplate').html();
            template = template.replace(/case_document_name/g, 'case_update_name_'+docCount);
            template = template.replace(/case_document_id/g, 'case_update_id_'+docCount);
            $(e.target).before(template);
            if(typeof sqs_objects == 'undefined'){
                sqs_objects = new Array;
            }
            sqs_objects['EditView_case_document_name_'+docCount]={
                "form":"EditView",
                "method":"query",
                'modules': 'Documents',
                "field_list":["name","id"],
                "populate_list":["case_document_name_"+docCount,"case_document_id_"+docCount],
                "required_list":["case_document_id_"+docCount],
                "conditions":[{"name":"name","op":"like_custom","end":"%","value":""}],
                "limit":"30",
                "no_match_text":"No Match"};
            SUGAR.util.doWhen(
                    "typeof(sqs_objects) != 'undefined' && typeof(sqs_objects['EditView_case_document_name_"+docCount+"']) != 'undefined'",
                    enableQS
            );

            $('.caseDocumentTypeSelect').change();
            docCount++;
        });
        $(document).on('click','.removeFileButton',function(e){
            $(e.target).closest('span').remove();
        });
    });
</script>
{/literal}
<script id="updateFileRowTemplate"  type="text/template">
    <span class="caseDocumentWrapper">
        <select class="caseDocumentTypeSelect">
            <option value="internal">{$MOD.LBL_SELECT_INTERNAL_CASE_DOCUMENT}</option>
            <option value="external">{$MOD.LBL_SELECT_EXTERNAL_CASE_DOCUMENT}</option>
        </select>
        <input type="file" id="case_update_file[]" name="case_update_file[]">
        <span class="internalCaseDocumentWrapper">
            <input type="text" name="case_document_name" class="sqsEnabled" tabindex="0" id="case_document_name" size="" value="" title='' autocomplete="off">
            <input type="hidden" name="case_document_id" id="case_document_id" value="">

            <span class="id-ff multiple">
                <button type="button" name="btn_case_document_name" id="btn_case_document_name" tabindex="0" title="{$MOD.LBL_SELECT_CASE_DOCUMENT}" class="button firstChild" value="{$MOD.LBL_SELECT_CASE_DOCUMENT}"
                        {literal}
                        onclick='open_popup(
                                "Documents",
                                600,
                                400,
                                "",
                                true,
                                false,
                                {"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"case_document_id","name":"case_document_name"}},
                                "single",
                                true
                                );' >
                        {/literal}
                <span class="suitepicon suitepicon-action-select"></span></button>
                <button type="button" name="btn_clr_case_document_name"
                        id="btn_clr_case_document_name" tabindex="0" title="{$MOD.LBL_CLEAR_CASE_DOCUMENT}"  class="button lastChild"
                        onclick="SUGAR.clearRelateField(this.form, 'case_document_name', 'case_document_id');"  value="{$MOD.LBL_CLEAR_CASE_DOCUMENT}" ><span class="suitepicon suitepicon-action-clear"></span></button>
            </span>
        </span>

<button class="removeFileButton" type="button">{$MOD.LBL_REMOVE_CASE_FILE}</button><br>
    </span>

</script>

Ok so I came home and on my VMware server here I have version 7.11.22 that I had installed several months ago to demo it to a company I thought might be interested in using it. I am getting the same error on this system. Its a generic install with no customization.

@pstevens , take a look at your tpl file. Syntactically, the > above the last {/literal} should really be after the {/literal} but that is not the problem here. Just thought I would point that out.

@pgr @pstevens
I get the same error on the on demand demo site:

https://demo.suiteondemand.com/index.php
Here’s how to test:

  1. Go to Cases
    
  2. Open up a Developer Console on your browser
    
  3. Click on the Create Case
    

I get the same error on both Windows and Linux machines. Browsers, Firefox, Chrome and Edge.

I get the same error, but it’s not preventing the case creation or any other functionality. What’s the issue?

I was having problems with some of my custom script in custom/modules/Casses/js/editview.js.
It was when I opened the console window to debug my own JavaScript that I found this error.
Additionally, I noticed that when opening a Case in the DetailView and adding a Case Update, on my system the update would be saved as “undefined”. But I found this to be a duplicated field on the form.

At the end of the day it is an error caused by something and its obvious that it is not just my site where this is occurring and not limited to a particular version or web browser.

I’ll most likely keep digging into it to try and figure out what is causing it.

Thanks for your input.

Tony

I have found a work around for this error as well as placed an issue on Github Issue #9739

To fix I wrapped lines 3009-3016 in the file jssource/src_files/include/javascript/sugar_3.js with an if statement to check to see if the script is a text/template. If so, then don’t eval.

From:

  var srcRegex = /<!--([\s\S]*?)-->/;
  var srcResult = srcRegex.exec(result[2]);
  if (srcResult && srcResult.index > -1) {
	SUGAR.util.globalEval(srcResult[1]);
  }
  else {
	SUGAR.util.globalEval(result[2]);
  }

To:

if (result[1].indexOf("text/template") == -1) {
  var srcRegex = /<!--([\s\S]*?)-->/;
  var srcResult = srcRegex.exec(result[2]);
  if (srcResult && srcResult.index > -1) {
	SUGAR.util.globalEval(srcResult[1]);
  }
  else {
	SUGAR.util.globalEval(result[2]);
  }
}

Followed by running the admin command Rebuild JS Grouping Files and Quick Repair and Rebuild.

Remember this edits one of the core JavaScript source files so any future upgrades might overwrite your changes to this file.

1 Like