Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Please tell me how to deal with the script error "GlideTabs2 findTabIndexByID could not find~".

Risa4
Tera Contributor

Hi,all

I would like to run the attached script in a job schedule.
However, I get the following error message and cannot run it.
In particular, the error message "sysauto_script.doGlideTabs2 findTabIndexByID could not find section_tab.6ac0938cc0a8000601867d03033a59bd" seems to be a problem. I'm assuming that the sysid shown here is for sys_attachment, but it's not the id I want to get.

How can I run this script without getting an error?

A summary of the script is also provided.

 

◆A summary of the script

Check the contents of the CSV file attached to the table and insert a record in any field.

 

◆Error Message=======================================================================

00:10:02 (841)sysauto_script.dodirty form focus
00:10:02 (852)sysauto_script.doGlideTabs2 findTabIndexByID could not find section_tab.6ac0938cc0a8000601867d03033a59bd
00:10:02 (852)sysauto_script.doGlideTabs2 findTabIndexByID could not find section_tab.6ac0938cc0a8000601867d03033a59bd
00:10:02 (853)sysauto_script.doGlideTabs2 findTabIndexByID could not find section_tab.6ac0938cc0a8000601867d03033a59bd
00:10:02 (853)sysauto_script.doGlideTabs2 findTabIndexByID could not find section_tab.6ac0938cc0a8000601867d03033a59bd
00:10:02 (853)sysauto_script.doGlideTabs2 findTabIndexByID could not find section_tab.6ac0938cc0a8000601867d03033a59bd
00:10:03 (240)sysauto_script.do[00:00:00.387] *** WARNING *** GlideAjax.getXMLWait - synchronous function - processor: JSValidator
00:10:03 (249)sysauto_script.doGlideTabs2 findTabIndexByID could not find section_tab.6ac0938cc0a8000601867d03033a59bd
00:10:03 (249)sysauto_script.doGlideTabs2 findTabIndexByID could not find section_tab.6ac0938cc0a8000601867d03033a59bd
00:10:03 (862)sysauto_list.dorunning inline scripts, count: 0
00:10:03 (862)sysauto_list.dorunBeforeRender
00:10:03 (862)sysauto_list.dorunAfterAllLoaded, functions: 16
00:10:03 (873)sysauto_list.dofireAllChangeHandlers start
00:10:03 (873)sysauto_list.dofireAllChangeHandlers end
00:10:03 (873)sysauto_list.dolate load functions: 5
00:10:03 (873)sysauto_list.doClearing event handlers reference cache
00:10:03 (874)sysauto_list.do[00:00:00.012] runAfterAllLoaded finished
00:10:03 (911)sysauto_list.doafter page loaded starting
00:10:03 (919)sysauto_list.do[00:00:00.002] GwtListEditor onTableLoad, tables examined: 1
00:10:03 (926)sysauto_list.do[00:00:00.014] after page loaded complete, functions called: 6
00:10:03 (996)sysauto_list.do[00:00:00.005] Reclone headers

=========================================================

 

 

// 添付ファイルTableからCSVデータを抽出する
function getCsv(grAtt) {
    var gsAttachment = new GlideSysAttachment();
    var byteData = gsAttachment.getBytes(grAtt);
    var csvStr;
    var parser = new sn_impex.CSVParser();
    var headers;
    var csvObj;
    var csvList = [];
    var delimiter = ',';
    var quoteCharacter = '"';
    if (!byteData) return null;
    csvStr = '' + Packages.java.lang.String(byteData, 'UTF-8');// 'UTF-8' or 'MS932' (JavaのSJIS)
    if (!csvStr) return null;
    csvLine = csvStr.match(/[^\r\n]+/g);
    if (!csvLine) return null;
    headers = parser.parseLineToArray(csvLine[0], delimiter, quoteCharacter); //
    if (!headers) return null;
    for (var i = 1; i < csvLine.length; i++) {
        csvObj = parser.parseLineToObject(csvLine[i], headers, delimiter, quoteCharacter);
        csvList.push(csvObj);
    }
    return csvList;
}
//var grAtt;32行目にvar追加したためコメントアウト
var csvList;
// インシデントTableから今日一日に作成されたインシデントを検索して添付ファイルがあるなら情報を取得する
var grInc = new GlideRecord('incident');
gs.info('gs.endOfYesterday()=' + gs.endOfYesterday());
grInc.query();
while (grInc.next()) {
    var grAtt = new GlideRecord('sys_attachment');
    grAtt.addQuery('table_name', 'incident'); //inportst用sysidに変更
    grAtt.addQuery('table_sys_id', grInc.getUniqueValue());
    grAtt.query();
    //ひとつの添付ファイルのみ処理します。複数処理しないのでwhileに変更不要。
    while (grAtt.next()) {
		if(grAtt.table_sys_id == grInc.getUniqueValue())
		{
		csvList = getCsv(grAtt);
        if (csvList) {
            grInc.comments.setJournalEntry('CSV Data ' + JSON.stringify(csvList, null, 2)); //CSVファイルをJSON形式へ変換する処理
            if (grInc.update()) {
                gs.info(grInc.number + ' update'); //
            }
        }
		break;
		}
  
1 ACCEPTED SOLUTION

Brian Lancaster
Kilo Patron

Did the entire script not copy? You seem to be missing to end brackets "}" at the bottom of your script.

View solution in original post

1 REPLY 1

Brian Lancaster
Kilo Patron

Did the entire script not copy? You seem to be missing to end brackets "}" at the bottom of your script.